<!-- 1- create a new file called lab3.php
2- add the HTML skeleton code and give its title “Lab Week 3”
3- open up an php scope
4- Create an associative array listing favourite subjects. (example: math, english, science and grade for each A+ B+ C- )
5- print out for grade english subject
6- using a for loop print all the items in the array
-->
>
<?php
//Code for associative array
//data for associated array
$subjects = [
"math" => "A+",
"english" => "B+",
"science" => "C-",
]
<br>
// Code to print out english grade
//print out for english grade
echo "My grade in english class is" . $subjects["english"];
<br>
// This is my for loop section. If anyone could help me figure this out I'd be greatly appreciated.
//print out all the items in the array using for loop
for ($x=0; <= 2){
echo "$subjects[$x]";
}
?>
for ($x = 0; $x <= 2; ++$x)?