Saturday, 31 August 2013

I can't compare associative array indexes to a var

I can't compare associative array indexes to a var

I can not figure out how to compare the array index. I know this has to be
simple and I feel really...
$list_array array (
'first' => array('one' => 1, 'two' => 2),
'second' => array('one' => 3, 'two' => 4)
);
foreach ($list_array as $key) {
if(< The list_array index > == 'second' ) {
echo $key['one']. ' - '. $key['two'];
}
}
result 3 - 4

No comments:

Post a Comment