-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfor.php
More file actions
53 lines (42 loc) · 1.48 KB
/
for.php
File metadata and controls
53 lines (42 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!doctype html>
<html>
<head>
<title>PHP and For Loops</title>
</head>
<body>
<h1>PHP and For Loops</h1>
<p>Use PHP echo, if statements, and loops to output all three links.</p>
<?php
// **************************************************
// Do not edit this code
// Define a multi dimensional array to store all of the links
$links = array (
0 => array (
'name' => 'Codecademy',
'url' =>'https://www.codecademy.com/',
'image' => '',
'description' => 'Learn to code interactively, for free.' ),
1 => array (
'name' => '',
'url' => 'https://www.w3schools.com/',
'image' => 'w3schools.png',
'description' => 'W3Schools is optimized for learning, testing, and training.' ),
2 => array (
'name' => 'Mozilla Developer Network',
'url' => 'https://www.codecademy.com/',
'image' => 'mozilla.png',
'description' => 'The Mozilla Developer Network (MDN) provides information about Open Web technologies.' )
);
// **************************************************
// Loop through the array and display the link information
for ($i = 0; $i < count ($links); $i ++)
{
echo '<h1>'.$links[$i]['linkName'].'</h1>';
}
// Use the print_r function to view the contents of the array
echo '<pre>';
print_r ($links);
echo '</pre>';
?>
</body>
</html>