Function __global->substr_count
Definitions
sources_custom/phpstub.php
- Count the number of substring occurrences.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: int
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $haystack | string | No | No | required parameter | N/A | N/A | The subject |
| $needle | string | No | No | required parameter | N/A | N/A | The substring to search for in the subject |
| $offset | integer | No | No | 0 | N/A | N/A | Offset |
| $maxlen | ?integer | No | No | Null | N/A | N/A | Maximum length (null: no limit) |
Returns
- The number of times substring occurs in the subject
- Type: integer
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Count the number of substring occurrences.
*
* @param string $haystack The subject
* @param string $needle The substring to search for in the subject
* @param integer $offset Offset
* @param ?integer $maxlen Maximum length (null: no limit)
* @return integer The number of times substring occurs in the subject
*/
function substr_count(string $haystack, string $needle, int $offset = 0, ?int $maxlen = null) : int
* Count the number of substring occurrences.
*
* @param string $haystack The subject
* @param string $needle The substring to search for in the subject
* @param integer $offset Offset
* @param ?integer $maxlen Maximum length (null: no limit)
* @return integer The number of times substring occurs in the subject
*/
function substr_count(string $haystack, string $needle, int $offset = 0, ?int $maxlen = null) : int

