Home Php Cerca nell’array

Cerca nell’array

504
0

Per cercare un determinato valore in array si puo` eseguire questo piccolo script che vi aiutera nella ricerca.

foreach($array as $subarray)
{
   if(in_array('hello', $subarray))
   {
      echo 'echo the value';
   }
}

$os = array("Mac", "NT", "Irix", "Linux");
if (in_array("Irix", $os)) {
    echo "Trovato Irix";
}
if (in_array("mac", $os)) {
    echo "Trovato mac";
}
Previous articlePython
Next articleWaypoints

LEAVE A REPLY

Please enter your comment!
Please enter your name here