Re: Problems with PHP4 & arrays
| From: | Andy Styles | Date: | Tue, 06 Jun 2000 13:17:26 +0000 |
| Subject: | Re: Problems with PHP4 & arrays | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1128@lists.php.net to get a copy of this message | ||
On Tue, 06 Jun 2000 15:09:27 +0200, Andrea Busia wrote:
>I have written this little Script:
>
><?
>$TIT[0]=5;
>$TIT[1]=3;
>$TIT[2]=6;
>$TIT[4]=9;
>$TIT[7]=2;
>for ($i=0; $i<sizeof($TIT); $i++) {
>echo $i." - ".$TIT[$i]."<br>\n";
>}
>?>
If you haven't had a reply, this works, although there's probably a
better way to do it:
$TIT[0]=5;
$TIT[1]=3;
$TIT[2]=6;
$TIT[4]=9;
$TIT[7]=2;
end($TIT);
$max = each($TIT);
for ($i=0; $i<$max[0]+1; $i++)
{
echo $i." - ".$TIT[$i]."<br>\n";
}
Andy.