_____________________________Esse código acima está apresentando os seguintes erros (abaixo) _______________________________________________________________
Before Sorting:
Notice: Undefined variable: valeu in C:\\xampp\\htdocs\\php_ead\\cursophp\\apphpdspag98.ex4.24.php on line 30
$dinner: 0
Notice: Undefined variable: valeu in C:\\xampp\\htdocs\\php_ead\\cursophp\\apphpdspag98.ex4.24.php on line 30
$dinner: 1
Notice: Undefined variable: valeu in C:\\xampp\\htdocs\\php_ead\\cursophp\\apphpdspag98.ex4.24.php on line 30
$dinner: 2
Notice: Undefined variable: meal in C:\\xampp\\htdocs\\php_ead\\cursophp\\apphpdspag98.ex4.24.php on line 34
Warning: Invalid argument supplied for foreach() in C:\\xampp\\htdocs\\php_ead\\cursophp\\apphpdspag98.ex4.24.php on line 34
Warning: sort() expects parameter 1 to be array, null given in C:\\xampp\\htdocs\\php_ead\\cursophp\\apphpdspag98.ex4.24.php on line 39
After Sorting: $dinner: 0 Braised Bamboo Fungus $dinner: 1 Lemon Chicken $dinner: 2 Sweet Corn and Asparagus
Warning: Invalid argument supplied for foreach() in C:\\xampp\\htdocs\\php_ead\\cursophp\\apphpdspag98.ex4.24.php on line 45
Obs: Já conferi 5 vezes esse código e está exatamente como no livro .
Pergunta
Manckenna
<html>
<head>
<meta charset="utf-8">
<title>Array</title>
</head>
<body>
<?php
//Exemplo 4.24 da Página 98 do Livro Aprendendo PHP de David Sklar
// Classificando com sort()
$dinner = array('Sweet Corn and Asparagus',
'Lemon Chicken',
'Braised Bamboo Fungus');
$mel= array('breakfast' => 'Walnut Bun',
'lunch' =>'Cashew Nuts and White Mushroons',
'snack' => 'Dried Mulberries',
'dinner' => 'Eggplant with Chili Sauce');
print "Before Sorting:\\n";
foreach ($dinner as $key => $value) {
print " \\$dinner: $key $valeu\\n";
}
foreach ($meal as $key => $value){
print "\\ $meal: $key $value\\n";
}
sort($dinner);
sort($meal);
print "After Sorting:\\n";
foreach ($dinner as $key => $value) {
print " \\$dinner: $key $value\\n";
}
foreach($meal as $key => $value) {
print " \\$meal: $key $value\\n";
}
?>
</body>
</html>
_____________________________Esse código acima está apresentando os seguintes erros (abaixo) _______________________________________________________________
Before Sorting:
Notice: Undefined variable: valeu in C:\\xampp\\htdocs\\php_ead\\cursophp\\apphpdspag98.ex4.24.php on line 30
$dinner: 0
Notice: Undefined variable: valeu in C:\\xampp\\htdocs\\php_ead\\cursophp\\apphpdspag98.ex4.24.php on line 30
$dinner: 1
Notice: Undefined variable: valeu in C:\\xampp\\htdocs\\php_ead\\cursophp\\apphpdspag98.ex4.24.php on line 30
$dinner: 2
Notice: Undefined variable: meal in C:\\xampp\\htdocs\\php_ead\\cursophp\\apphpdspag98.ex4.24.php on line 34
Warning: Invalid argument supplied for foreach() in C:\\xampp\\htdocs\\php_ead\\cursophp\\apphpdspag98.ex4.24.php on line 34
Warning: sort() expects parameter 1 to be array, null given in C:\\xampp\\htdocs\\php_ead\\cursophp\\apphpdspag98.ex4.24.php on line 39
After Sorting: $dinner: 0 Braised Bamboo Fungus $dinner: 1 Lemon Chicken $dinner: 2 Sweet Corn and Asparagus
Warning: Invalid argument supplied for foreach() in C:\\xampp\\htdocs\\php_ead\\cursophp\\apphpdspag98.ex4.24.php on line 45
Obs: Já conferi 5 vezes esse código e está exatamente como no livro .
Link para o comentário
Compartilhar em outros sites
1 resposta a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.