Function __global->substr_compare
Definitions
sources_custom/phpstub.php
- Binary safe optionally case-insensitive comparison of two strings from an offset, up to length characters.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $main_str | string | No | No | required parameter | N/A | N/A | The main string being compared |
| $str | string | No | No | required parameter | N/A | N/A | The secondary string being compared |
| $offset | integer | No | No | required parameter | N/A | N/A | The start position for the comparison. If negative, it starts counting from the end of the string. |
| $length | ?integer | No | No | Null | N/A | N/A | The length of the comparison (null: the largest of the length of the str compared to the length of main_str less the offset) |
| $case_insensitivity | boolean | No | No | False | N/A | N/A | Whether to compare as case-insensitive |
Returns
- Returns < 0 if main_str from position offset is less than str, > 0 if it is greater than str, and 0 if they are equal (false: out of bounds)
- Type: ~integer
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Binary safe optionally case-insensitive comparison of two strings from an offset, up to length characters.
*
* @param string $main_str The main string being compared
* @param string $str The secondary string being compared
* @param integer $offset The start position for the comparison. If negative, it starts counting from the end of the string.
* @param ?integer $length The length of the comparison (null: the largest of the length of the str compared to the length of main_str less the offset)
* @param boolean $case_insensitivity Whether to compare as case-insensitive
* @return ~integer Returns < 0 if main_str from position offset is less than str, > 0 if it is greater than str, and 0 if they are equal (false: out of bounds)
*/
function substr_compare(string $main_str, string $str, int $offset, ?int $length = null, bool $case_insensitivity = false)
* Binary safe optionally case-insensitive comparison of two strings from an offset, up to length characters.
*
* @param string $main_str The main string being compared
* @param string $str The secondary string being compared
* @param integer $offset The start position for the comparison. If negative, it starts counting from the end of the string.
* @param ?integer $length The length of the comparison (null: the largest of the length of the str compared to the length of main_str less the offset)
* @param boolean $case_insensitivity Whether to compare as case-insensitive
* @return ~integer Returns < 0 if main_str from position offset is less than str, > 0 if it is greater than str, and 0 if they are equal (false: out of bounds)
*/
function substr_compare(string $main_str, string $str, int $offset, ?int $length = null, bool $case_insensitivity = false)

