$students = array ( 'John' => array('department' => "History", 'grade' => 'A+'), 'Peter' => array('department' => "Science", 'grade' => 'A+'), 'George' => array('department' => "Physics", 'grade' => 'A'), 'Michael' => array('department' => "Maths", 'grade' => 'A+')); print '
'; print_r($students); print '
'; //another way to display foreach($students as $student => $result) { echo $student.' is '. $result['department']. ' student and his grade is '.$result['grade'] .'
'; }
Hello World!