Difference between strstr and stristr in php


strstr() and stristr both are used to find the first occurence of the string.

stristr( ) is case insensitive and strstr( ) is case sensitive.


string strstr ( string $haystack , mixed $needle [, bool $before_needle = false ] )

haystack
The input string.
needle
If needle is not a string, it is converted to an integer and applied as the ordinal value of a character.
before_needle
If TRUE, strstr() returns the part of the haystack before the first occurrence of the needle (excluding the needle). By default it is FALSE.

strstr() – Find first occurrence of a string Continue reading

Advertisements