PHP function substr_compare()
Availability in PHP 5.0
Binary safe comparison of 2 strings from offset up to character length
Parameters
| Parameter | Data type | Default value | Note |
|---|---|---|---|
$main_str |
string |
not | Main string being compared. |
$str |
string |
not | Main string being compared. |
$offset |
int |
not | Starting position for comparison. If negative, it starts counting from the end of the string. |
$length |
int |
null, | Length of the comparison. |
$case_insensitivity |
bool |
null | If case_insensitivity is true, the comparison is not case sensitive. |
Return values
int
0ifmain_strof offset position is less than str0if it is greater than str0if they are equal.
If offset is equal to or greater than the length of main_str or the length is set and is less than 1, substr_compare prints a warning and returns false.