选择语言 :

 Core_UTF8::strcasecmp

Case-insensitive UTF-8 string comparison. This is a UTF8-aware version of strcasecmp.

$compare = UTF8::strcasecmp($str1, $str2);

integer Core_UTF8::strcasecmp( string $str1 , string $str2 )
author
Harry Fuecks hfuecks@gmail.com

参数列表

参数 类型 描述 默认值
$str1 string String to compare
$str2 string String to compare
返回值
  • integer less than 0 if str1 is less than str2
  • integer greater than 0 if str1 is greater than str2
  • integer 0 if they are equal
File: ./core/classes/utf8.class.php
public static function strcasecmp($str1, $str2)
{
    if ( UTF8::is_ascii($str1) && UTF8::is_ascii($str2) ) return strcasecmp($str1, $str2);

    $str1 = UTF8::strtolower($str1);
    $str2 = UTF8::strtolower($str2);
    return strcmp($str1, $str2);
}