RE: [PHP] need help w a for loop
| From: | Ray Hunter | Date: | Mon, 20 Oct 2003 22:12:36 +0000 |
| Subject: | RE: [PHP] need help w a for loop | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-166858@lists.php.net to get a copy of this message | ||
> > Or you could try this:
> >
> > $categories_array = array();
> >
> > for( $j = 0; $j < $categories_count; $j++ ) {
> > $tempval = "str_categories".$j;
> > $categories[$j] = $_REQUEST[$tempval];
> > }
>
> Or you could get really fancy and try this (my preferred method if not a
> little confusing):
>
> $j = -1;
> $categories_array = array();
>
> while(++$j < $categories_count)
> {
> $categories[$j] = $_REQUEST["str_categories".$j];
> }
And your while loop is going to be much faster than the for loop...
:)
--
BigDog