I'm trying to remove an item from a array
corresponding to [NUMBER] but it's not working.
Array:
Array
(
[0] => Array
(
[NUMERO] => 123
[DATA] => 11/11/1111
[VALOR] => 2,22
[ARQUIVO] =>
)
[1] => Array
(
[NUMERO] => 456
[DATA] => 12/12/1212
[VALOR] => 33,33
[ARQUIVO] =>
)
)
I called this function to return the KEY and then remove it:
function hasArrayKey( $array, $value ){
foreach( $array as $key => $temp ){
if( array_search( $value, $temp ) !== false ){
return $key;
}
}
return false;
}
Plus it removes the KEY "0" if it does not find:
$nota = hasArrayKey( $_SESSION['NOTAS'], '999' );
if( $nota >= 0 ){
unset( $_SESSION['NOTAS'][$nota] );
}
if( !$nota ){
echo "Nota not found\n";
}
Any ideas, guys?