hunglduc Posted April 5, 2009 Share Posted April 5, 2009 what is haystack and needle? Link to comment Share on other sites More sharing options...
boen_robot Posted April 5, 2009 Share Posted April 5, 2009 It's a metaphore... haven't you heared the saying "It's like trying to find a needle in a haystack."?So, when you say for example: int strpos ( string $haystack , mixed $needle [, int $offset= 0 ] ) The $needle is what you're looking for, and the $haystack is the place where you're looking for it. In this case: strpos('abcd', 'a'); will search 'abcd' for the string 'a', and since 'a' is the first character in the string, the function call above will return 0. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.