simple array query
Posted: Sun Nov 15, 2009 3:27 am
Dear All,
I would expect the following to produce the integers 0 to 10 & their respective squares. However it produces a blank screen. Any idea why ? thanks
Kaps
P.S I did try and use the code tags (and previewed the code before submission) but no joy. Does anybody know why ?
[code = php]
<?php
for($i=0;$i++;$i<10)
{
$squared[$i] = $i*$i;
printf("%d %d",$i,$squared[$i]);
}
print_r ($squared);
?>
I would expect the following to produce the integers 0 to 10 & their respective squares. However it produces a blank screen. Any idea why ? thanks
Kaps
P.S I did try and use the code tags (and previewed the code before submission) but no joy. Does anybody know why ?
[code = php]
<?php
for($i=0;$i++;$i<10)
{
$squared[$i] = $i*$i;
printf("%d %d",$i,$squared[$i]);
}
print_r ($squared);
?>