array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'es', ), 'this' => array ( 0 => 'function.strcasecmp.php', 1 => 'strcasecmp', ), 'up' => array ( 0 => 'ref.strings.php', 1 => 'Funciones de strings', ), 'prev' => array ( 0 => 'function.str-word-count.php', 1 => 'str_word_count', ), 'next' => array ( 0 => 'function.strchr.php', 1 => 'strchr', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'es', 'path' => 'reference/strings/functions/strcasecmp.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
strcasecmp — Comparación de string segura a nivel binario e insensible a mayúsculas y minúsculas
Comparación de string segura a nivel binario e insensible a mayúsculas y minúsculas.
str1
El primer string
str2
El segundo string
Devuelve < 0 si str1
es menor que
str2
; > 0 si str1
es mayor que str2
y 0 si son
iguales.
Ejemplo #1 Ejemplo de strcasecmp()
<?php
$var1 = "Hello";
$var2 = "hello";
if (strcasecmp($var1, $var2) == 0) {
echo '$var1 is equal to $var2 in a case-insensitive string comparison';
}
?>