Hi i am studying a book on PHP and they made me write a script that could display data from a array with [Key] and [Value] trick.
When i upload it to my lycos server it doesn’t display the array data.
this is the script:
<html>
<head>
<title>Arrays sorteren</title>
</head>
<body>
<?php
$Cijfers = array(
"Richard"=>"95",
"Willem"=>"82",
"Ton"=>"98",
"Frans"=>"87",
"Melissa"=>"75",
"Jaap"=>"85"
);
print ("Het array ziet er origineel zo uit:<BR>");
for ($n = 0; $n < count($Cijfers); $n++) {
$Regel = each ($Cijfers);
print ("Het cijfer van $Regel[Key] is $Regel[Value].<BR>
");
}
arsort($Cijfers);
reset($Cijfers);
print ("<P>Het array ziet er zo uit nadat het op waarde is gesorteerd met arsort():<BR>");
for ($n = 0; $n < count($Cijfers); $n++) {
$Regel = each ($Cijfers);
print ("Het cijfer van $Regel[Key] is $Regel[Value].<BR>
");
}
ksort($Cijfers);
reset($Cijfers);
print ("<P>Het array ziet er zo uit nadat het op sleutel is gesorteerd met ksort():<BR>");
for ($n = 0; $n < count($Cijfers); $n++) {
$Regel = each ($Cijfers);
print ("Het cijfer van $Regel[Key] is $Regel[Value].<BR>
");
}
?>
</body>
</html>
This is the url to the file online:
http://www.vectar.nl/PHP/Hoofdstuk_7/sorteren.php
Can someone tell me what the problem could be ?
Lycos supports PHP5 and the [Key] and [Value] trick is a PHP4 feature so it should work in PHP5 i think ?
Please help me out
Thanks in advance