I have a PHP array like this...
[level1] => Array
(
[random475item] => Array
(
[attr1] => tester1
[attr2] => tester2
[attr3] => tester3
)
[random455item] => Array
(
[attr1] => tester1
[attr2] => tester2
[attr3] => tester3
)
)
I am trying to get the values of the attr2
fields in a new array. I can specify a specific like this...
$newarray = array();
newarray [] = $array['level1']['random475item']['attr2'];
newarray [] = $array['level1']['random455item']['attr2'];
But is there a way to automate this as it could be 50 random items coming up and I don't want to have to keep adding them manually.