
14/01/2003, 03:58
|
 | | | Fecha de Ingreso: enero-2002 Ubicación: Catalunya
Mensajes: 6.459
Antigüedad: 23 años, 2 meses Puntos: 17 | |
Cita: Example 1. in_array() example
$os = array ("Mac", "NT", "Irix", "Linux");
if (in_array ("Irix", $os)) {
print "Got Irix";
}
if (in_array ("mac", $os)) {
print "Got mac";
}
The second condition fails because in_array() is case-sensitive, so the program above will display:
Got Irix
Example 2. in_array() with strict example
<?php
$a = array('1.10', 12.4, 1.13);
if (in_array('12.4', $a, TRUE))
echo "'12.4' found with strict check\n";
if (in_array(1.13, $a, TRUE))
echo "1.13 found with strict check\n";
?>
This will display:
1.13 found with strict check Fuente: http://www.php.net/manual/en/function.in-array.php |