oppure , la documentazione php propone anche questo:
che se trova il valore restituisce pure il numero della posizione...Codice PHP:
<?php
$array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red');
$key = array_search('green', $array); // $key = 2;
$key = array_search('red', $array); // $key = 1;
?>
cmq la soluzione di marco80 dovrebbe andare piu che bene![]()