Php string in string function


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.