-
Notifications
You must be signed in to change notification settings - Fork 0
/
array2.php
64 lines (55 loc) · 1.45 KB
/
array2.php
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
59
60
61
<?php
/**
*Outras formas de declarar e atribuir valores à um array
* $aAlunos = []; O mesmo que $aAlunos = array();
* $aAlunos = ["Lucas","Bianca","Jorge","Maurício"];
*/
// $aAlunos = array([
// array ([ "matricula" => 1, "nome" => "Lucas" ]) ,
// array ([ "matricula" => 2, "nome" => "Bianca" ]) ,
// array ([ "matricula" => 3, "nome" => "Jorge" ]) ,
// array ([ "matricula" => 4, "nome" => "Maurício" ]) ,
// array ([ "matricula" => 5, "nome" => "Wanderlei" ])
// ]);
echo "<link rel='stylesheet' type='text/css' href='css/estilo.css'>";
$aAlunos = [
[
"matricula" => 1,
"nome" => "Lucas",
"email" => "lucas@email.com",
],
[
"matricula" => 2,
"nome" => "Bianca",
"email" => "bianca@email.com",
],
[
"matricula" => 3,
"nome" => "Jorge",
"email" => "jpassos@email.com",
],
[
"matricula" => 4,
"nome" => "Maurício",
"email" => "msilva@email.com",
],
[
"matricula" => 5,
"nome" => "Wanderlei",
"email" => "wander.silva@gmail.com",
],
];
echo "<table border='1'>
<thead>
<tr>
<th>Matrícula</th>
<th>Nome</th>
<th>E-mail</th>
</tr>
</thead>";
echo "<tbody>";
foreach ($aAlunos as $aluno) {
printf("<tr><td>%s</td><td>%s</td><td>%s</td></tr>",
$aluno["matricula"], $aluno["nome"], $aluno["email"]);
}
echo "</tbody></table>";