I'm reading a "Dummies" book on PHP and MySQL. I'm learning about "passing the right type of values" and came across this script:
<?php
function add_numbers($numbers)
{
if(is_array($numbers))
{
for($i=0;$i <sizeof($numbers);$i++)
{
@$sum = $sum + $numbers($i);
}
echo $sum;
}
else
{
echo "value passed is not an array";
return;
}
}
$arrayofnumbers = array(100,200);
add_numbers($arrayofnumbers);
?>
According to the book it says that it should display 300, but when I typed this script in word-for-word into AceHTML (program I'm using) and viewed it in both IE and Firefox, it just displays a blank page, and in the source of the page it just says
<html>
</html>
am I doing something wrong? I've checked each letters, numbers and special characters, and it seems to be exactly as it is written in the book. Any help would be appreciated!