I'm new to php and learning how to read a multidim. array. I'm facing some issues here whenever I got an "id" (1,2,3 etc)
Code: Select all
$Tab= array(
1=> array('sex' => 'm',
'title' => 'it'
),
2=> array('sex' => 'f',
'title' => 'med'
),
3=> array('sex' => 'f',
'title' => 'med'
),
4=> array('sex' => 'f',
'title' => 'it'
),
5=> array('sex' => 'm',
'title' => 'it'
),
);
Code: Select all
// find size of the array
$size = count($Tab);
// array keys
$keys = arra_keys($elts);
// using the for loop
for($i = 0; $i < $size; $i++)
{
echo $keys[$i]. "\n";
foreach($elts[$keys[$i]] as $key => $value) {
echo $key . " : " . $value . "\n";
}
echo "\n";
}
Code: Select all
Fatal error: Uncaught Error: Call to undefined function arra_keys() in C:\xampp\htdocs\xml.php:5 Stack trace: #0 {main} thrown in C:\xampp\htdocs\xml.php on line 5