Hi All,
I am trying some code from a PHP5 Unleashed book and either I made a mistake or they did.
I checked their site and there is no typos on their printed version and they do not have source code for that chapter, so I am looking for some help.
Here is the code...
$petshack['name'] = array('Rosco', 'Icky', 'Rex', 'Buster', 'Delta');
$petshack['owner'] = array('John', 'Ann', 'Cliff', 'Amy', 'Hollie');
$petshack['weight'] = array(20, 10, 3, 54, 30);
$petshack['animal'] = array('Dog', 'Cat', 'Iguana', 'Dog', 'Dog');
/* Begin sort */
asort($petshack['weight'], SORT_NUMERIC);
foreach($petshack['weight'] as $key=>$weight) {
echo "<tr>";
echo "<td>{$petshack['name'][$key]}</td><td>{$petshack['owner'][$key]}</td>";
echo "<td>{$weight}</td><td>{$petshack['animal'][$key]}</td>";
echo "</tr>";
}
I dont see the error, can someone help out here?
Thanks in advance,
don