Name

substr_compare

Synopsis

int substr_compare(string first, string second, string offset[, int length[, bool case_insensitivity]])

Compares first, starting at the position offset, to second. If length is specified, a maximum of that many characters are compared. Finally, if case_insensitivity is specified and true, the comparision is case-insensitive. Returns a number less than zero if the substring of first is less than second, zero if they are equal, and a number greater than zero if the substring of first is greater than second.

Get Programming PHP, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.