Advertisement
alex1984vn

php indexOf

Sep 12th, 2011
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.23 KB | None | 0 0
  1. <?php
  2. $var = "bowchickawowwow";
  3. if (instr($var, "chicka")) print "needle found in the haystack!";
  4.  
  5. function instr($haystack, $needle) {
  6.   $pos = strpos($haystack, $needle, 0);
  7.   if ($pos != 0) return true;
  8.   return false;
  9. }
  10. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement