PHP function strstr()

Availability in PHP 4.0

Find first occurrence of a string

Parameters

Parameter Data type Default value Note
$haystack string not String being processed.
$needle mixed not If needle is not a string, it is converted to an integer and applied as the ordinal value of a character.
$before_needle bool null If true, strstr returns the part of the haystack before the first occurrence of the needle.

Return values

string

the portion of string, or false if needle is not found.

Other resources

Official strstr documentation

Newsletter

Nejlepsi tipy a triky o PHP do Vaseho e-mailu. Clanky a novinky nejen ze sveta PHP a programovani.