This site is mobile accessible. Press the "Tap Here" button to use a different font-size.


Smartphone icons created by Freepik - Flaticon

PHP String Functions

strpos() - Search For a Text Within a String

6

<?php
// Search For a Text Within a String
echo strpos("Hello world!", "world");
?>

The PHP strpos() function searches for a specific text within a string. If a match is found, the function returns the character position of the first match. If no match is found, it will return FALSE.
Tip: The first character position in a string is 0 (not 1).