|
Posted by fabrice rιgnier on 02/15/07 13:42
Hi all ;)
Here is my array of arrays:
$res= array();
$res[]=array("name" => "Smith" , "age" => 10);
$res[]=array("name" => "Johnson" , "age" => 20);
$res[]=array("name" => "Adam" , "age" => 0);
$res[]=array("name" => "Sullivan" , "age" => 15);
print_r($res);
Array (
[0] => Array ( [name] => Smith [age] => 10 )
[1] => Array ( [name] => Johnson [age] => 20 )
[2] => Array ( [name] => Adam [age] => 0 )
[3] => Array ( [name] => Sullivan [age] => 15 )
)
My question is: i'd like to delete all records that have their age = 0
As a result, i'd like to see :
Array (
[0] => Array ( [name] => Smith [age] => 10 )
[1] => Array ( [name] => Johnson [age] => 20 )
[2] => Array ( [name] => Sullivan [age] => 15 )
)
I've tried array_filter, array_splice, unset & array_shift but without
any success. I guess i miss something in the multi-dimensional array
management.
Thanx in advance ;)
f.
Navigation:
[Reply to this message]
|