PHP strstr() Function

PHP strspn() Function
PHP strtok() Function

what is the syntax of the STRSTR() function in php?

strstr(string,search,before_search)
ParameterDescription
stringRequired. Specifies the string to search
searchRequired. Specifies the string to search for. If this parameter is a number, it will search for the character matching the ASCII value of the number
before_searchOptional. A boolean value whose default is “false”. If set to “true”, it returns the part of the string before the first occurrence of the search parameter.
PHP STRSTR() method

examples of the STRSTR() function

Example 1. In this example, we find the first occurrence of “world” inside “Hello world!” and return the rest of the string.

<?php
echo strstr("Hello world!","world");
?>

Example 2. In this example, we search a string for the ASCII value of “o” and return the rest of the string:

<?php
echo strstr("Hello world!",111);
?>

Example 3. In this example, we return the part of the string before the first occurence of “world”.

<?php
echo strstr("Hello world!","world",true);
?>
PHP strspn() Function
PHP strtok() Function
en English
X
Scroll to Top