the developer can name this file ./EXAMPLES/ARRAY/find.php

please note the

strpos or stripos !== false

without it, if a substring is found within a string at position 0

for if 0 equals false

$mystring = 'abc';
$findme = 'a';
$pos = strpos($mystring, $findme);
$pos = stripos($mystring, $findme); // do not care about upper or lower case

// The !== operator can also be used. Using != would not work as expected
// because the position of 'a' is 0. The statement (0 != false) evaluates
// to false.
if ($pos !== false)
echo "The string '$findme' was found in the string '$mystring'";
echo " and exists at position $pos";
echo "The string '$findme' was not found in the string '$mystring'";

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!