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'; Quote Link to comment https://forums.phpfreaks.com/topic/277628-strposstristrstrstr-not-returning-true-when-they-should-be/ Share on other sites More sharing options...
Solution Jessica Posted May 4, 2013 Solution Share Posted May 4, 2013 (edited) 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. Edited May 4, 2013 by Jessica Quote 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! Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.