CKTIS / PHP
strcasecmp()
Compare two byte strings without ASCII letter case, returning a negative integer, zero or a positive integer.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
strcasecmp(string $string1, string $string2): intCompare two byte strings without ASCII letter case, returning a negative integer, zero or a positive integer. Since PHP 8.2 the comparison uses locale-independent ASCII folding. Only the sign is specified, so do not rely on a particular magnitude or use it as a Unicode collation routine.
Signature
strcasecmp(string $string1, string $string2): int
Example output
[0,true,false]
Examples
<?php
echo json_encode([strcasecmp("Ab","aB"),strcasecmp("ab","ac")<0,strcasecmp("\u{00C9}","\u{00E9}")===0]);
Result
[0,true,false]