Current Location: Home> Function Categories> stristr

stristr

Case-insensitive strstr
Name:stristr
Category:String
Programming Language:php
One-line Description:Find where the string first appears in another string (case insensitive).

Definition and usage

stristr() function searches for the first occurrence of a string in another string.

Note: This function is binary safe.

Note: This function is case-insensitive. For case-sensitive searches, use strstr() function.

Example

Example 1

Find the first occurrence of "world" in "Hello world!" and return the remainder of the string:

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

Try it yourself

Example 2

Search the string with the ASCII value of "o" and return the remainder of the string:

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

Try it yourself

Example 2

Returns the string part before the first occurrence of "world":

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

Try it yourself

Similar Functions
Popular Articles