stristr
Case-insensitive strstr
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.
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
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
Returns the string part before the first occurrence of "world":
<?php echo strstr ( "Hello world!" , "WORLD" , true ) ; ?>
Try it yourself