Gen. partnerAlgotech

PHP function stripos()

Finds the position of the first occurrence of a string without character size resolution.

|
September 11, 2019

Availability in PHP 5.0

Finds the position of the first occurrence of a string without character size resolution.

TIP:

The stripos function has been used in the past to check whether a string contains a substring. Since PHP 8.0, there is a native str_contains() function for this.

Parameters

Parameter Data Type Default Value Note
$haystack string not String to search
$needle string not Note that a needle can be a string of one or more characters.
$offset int null The optional offset parameter allows you to specify which character in the haystack to start searching for. The returned position is still relative to the start of the stack.

Return values

int - returns the position where the found substring starts.

If the substring is not found in the searched string, return false.

Other resources

Official stripos 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.