Gen. partnerAlgotech

PHP function strstr()

Find first occurrence of a string

|
September 11, 2019

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

Loading comments...

Stay in the loop

Subscribe to our newsletter and get the latest cybersecurity news delivered straight to your inbox.

Your data is safe. You can unsubscribe from the newsletter at any time.