60 of 110 menu

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 strpos function,
    which returns the position of the first occurrence of a substring
English
БеларускаяEspañolРусский
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline