PHP Find in String
To find in a string in PHP use the function
strpos.
In the following example the function will return the position
of the first character 'c'. It occupies position
2, since the count starts from 0:
<?php
echo strpos('abc abc', 'c');
?>
Code execution result:
2
See Also
-
the
strposfunction,
which returns the position of the first occurrence of a substring