Find the position of the first occurrence of a substring in a string
None.
strpos ( string $haystack , mixed $needle [, int $offset = 0 ] ) : int
<?php
$str = 'abcd';
$pos_a = strpos($str, 'a');
$pos_e = strpos($str, 'e');
var_dump($pos_a);
var_dump($pos_e);
if($pos_e === false) {
echo "the String 'e' was not found in the string '$str'";
} else {
echo "the String 'e' exists at position $pos_e";
}
?>
int(0) bool(false) the String 'e' was not found in the string 'abcd'