Associative Array in php
Posted: Tue May 03, 2016 9:11 pm
Hello
am required to use associative array that will print out the year of registration of each module as well as the module code or name
am getting an error syntax error
<?php
// put your code here
//displaying each modules with years
$year=array("Eup1501"=>"2010","Ict1541"=>"2010","Ict1513"=>"2011",
"Ict1514"=>"2012","Ict1512"=>"2012","Ict1521"=>"2012","Ict1531"=>"2012",
"Ict1532"=>"2013","Fac1501","2015","Ict2611"=>"2014","Ict2621","2014",
"Ict2613"=>"2016","Ict2642","2016");
foreach($year as $x => &x_value){
echo "Key=" .$x . ",Value=" .$x_value;
echo "<br";
}
?>
am required to use associative array that will print out the year of registration of each module as well as the module code or name
am getting an error syntax error
<?php
// put your code here
//displaying each modules with years
$year=array("Eup1501"=>"2010","Ict1541"=>"2010","Ict1513"=>"2011",
"Ict1514"=>"2012","Ict1512"=>"2012","Ict1521"=>"2012","Ict1531"=>"2012",
"Ict1532"=>"2013","Fac1501","2015","Ict2611"=>"2014","Ict2621","2014",
"Ict2613"=>"2016","Ict2642","2016");
foreach($year as $x => &x_value){
echo "Key=" .$x . ",Value=" .$x_value;
echo "<br";
}
?>