Re: Create Array??
| From: | Evan Nemerson | Date: | Sun, 23 Sep 2001 06:45:16 +0000 |
| Subject: | Re: Create Array?? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-68401@lists.php.net to get a copy of this message | ||
$i=Array(); would probably be better as $temp=Array(); although i THINK
either one is redundant...
sorry
> /* Untested */
> $num = 32;
> $i=Array();
> for($x=1;$x<=$num;$x++) {
> $temp[$x]=0;
> };
> $i=array_keys($temp);
> unset($temp);
>
> On Saturday 22 September 2001 23:09, you wrote:
> > Hi,
> >
> > If I have a value $num = 32; based on this how can I create an Array of
> > numbers 1 - 32, something like this...
> >
> > <?
> > $num = "32";
> > for ($i = 1; $i <= $num; $i++)
> > {
> > // Do something
> > }
> > // And now $i = ("1","2","3",etc
> > ?>
> >
> > Any suggestions?? I cannot use array_push as this has to work on a PHP3
> > server.
> >
> > TIA
> > Ade