Gen. partnerAlgotech

PHP function substr_count()

Count the number of occurrences of a substring

|
September 11, 2019

Availability in PHP 4.0

Count the number of occurrences of a substring

Parameters

Parameter Data type Default value Note
$haystack string not String to search
$needle string not Substring to be searched
$offset int null, Offset from which to start counting
$length int null Maximum length after the specified offset to search for a substring. Print a warning if the offset plus length is greater than the length of the haystack.

Return values

int

This function returns an integer.

Other resources

Official substr-count 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.