Jump to content

strpos/stristr/strstr not returning true when they should be


kernelgpf

Recommended Posts

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';

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.