Posted By

gbot on 03/09/08


Tagged

search String


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

gbot
jamarama


Php string in string function


 / Published in: PHP
 

  1. // php has no "in_string" function, so here's one...
  2.  
  3. function in_string($needle, $haystack, $insensitive = 0) {
  4. if ($insensitive) {
  5. return (false !== stristr($haystack, $needle)) ? true : false;
  6. } else {
  7. return (false !== strpos($haystack, $needle)) ? true : false;
  8. }
  9. }

Report this snippet  

You need to login to post a comment.