← All built-ins / strpos()
strpos()
strpos(...$args): mixed
Parameters
| Name | Type | Description |
|---|---|---|
| $haystack | string | string to search in |
| $needle | string | string to search for |
Return value
0-based byte position of the first occurrence, or false when not found. Always compare with !== false — position 0 is falsy!
Example
$p = strpos("HolyPHP", "PHP");
echo $p, "
";
var_dump(strpos("HolyPHP", "java") === false);4 bool(true)