PHP stristr() Function

PHP stripos() Function
PHP strlen() Function

what is the syntax if the STRISTR() function in php?

stristr(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 STRISTR() method

examples of the STRISTR() 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 stristr("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 stristr("Hello world!",111);
?>

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

<?php
echo stristr("Hello world!","WORLD",true);
?>
PHP stripos() Function
PHP strlen() Function

Stay up-to-date about PHP!

We don’t spam!

en English
X
Scroll to Top