kernelgpf Posted May 4, 2013 Share Posted May 4, 2013 I've tried all 3 functions and I can't get it to return true when I clearly see what I'm looking for in the string. $string='<div class="lupin lumi1" style="background:url(\'/images/grey_pins2.png\') no-repeat 0 -70px;height:35px;overflow:hidden;width:19px"><a href="http://maps.google.com/maps?hl=en-US&gl=US&safe=0&client=firefox&rls=org.mozilla:en-US:official&num=10&filter=1&complete=0&pws=0&um=1&ie=UTF-8&q=back+pain+austin&fb=1&gl=us&hq=back+pain&am'; if (strpos($string, "/images/grey_pins" !== FALSE)) print 'found'; else print 'not found'; Link to comment https://forums.phpfreaks.com/topic/277628-strposstristrstrstr-not-returning-true-when-they-should-be/ Share on other sites More sharing options...
Jessica Posted May 4, 2013 Share Posted May 4, 2013 You have your parentheses messed up. (strpos($string, "/images/grey_pins" !== FALSE))Is passing strpos two arguments, first is: $string, second is: "/images/grey_pins" !== FALSE Fix your parens and it should work. Link to comment https://forums.phpfreaks.com/topic/277628-strposstristrstrstr-not-returning-true-when-they-should-be/#findComment-1428225 Share on other sites More sharing options...
kernelgpf Posted May 4, 2013 Author Share Posted May 4, 2013 That was exactly it, and I pulled out so much hair over it. Thanks! Link to comment https://forums.phpfreaks.com/topic/277628-strposstristrstrstr-not-returning-true-when-they-should-be/#findComment-1428226 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.