-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrays1.php
More file actions
58 lines (48 loc) · 1.06 KB
/
arrays1.php
File metadata and controls
58 lines (48 loc) · 1.06 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
54
55
56
57
58
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<?
/* $name1 = "John";
$name2 = "Paul";
$name3 = "George";
$name4 = "Ringo";
$name5 = "Pete";
print( $name1 );
print( $name2 );
print( $name3 );
print( $name4 );
print( $name5 );
*/
// var myBeatles = [ "John", "Paul", "George", "Ringo", "Pete" ]; /* JavaScript array */
/* $myBeatles = array( "John", "Paul", "George", "Ringo", "Pete" );
print( $myBeatles[ 0 ] );
print( $myBeatles[ 1 ] );
print( $myBeatles[ 2 ] );
print( $myBeatles[ 3 ] );
print( $myBeatles[ 4 ] );
*/
$singers = array( "Lorde",
"Cindy Lauper",
"Kesha",
"Beyonce",
"Cinder Block",
"Taylor Swift",
"Madonna",
"Adele" );
/* for( $i = 0; $i < count( $singers ); $i++ )
{
print( "<strong>Current singer</strong>: " . $singers[ $i ] );
print( "<br>" );
}
*/
foreach( $singers as $s )
{
print( "<strong>Current singer</strong>: {$s}" );
print( "<br>" );
}
?>
</body>
</html>