RE: [PHP] Logic headache, please help.
| From: | Marco Tabini | Date: | Mon, 11 Nov 2002 15:13:34 +0000 |
| Subject: | RE: [PHP] Logic headache, please help. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-123817@lists.php.net to get a copy of this message | ||
My guess is it works... but only one way to find out--try it! :-)
Marco
--
------------
php|architect - The magazine for PHP Professionals
The first monthly worldwide magazine dedicated to PHP programmers
Check us out on the web at http://www.phparch.com
On Mon, 2002-11-11 at 10:19, Tony Crockford wrote:
>
>
>
>
> > -----Original Message-----
> > From: Marco Tabini [mailto:marcot@tabini.ca]
> > Sent: 11 November 2002 14:46
> > To: Tony Crockford
> > Cc: Php-General@Lists. Php. Net
> > Subject: Re: [PHP] Logic headache, please help.
> >
> >
> > How about building an array of all the levels:
> >
> > $a = array();
> >
> > for ($i = 1; $i <= $maxlevels; $i++)
> > $a[] = $i;
> >
> > then for each level you can create a new array that is the difference
> > between the original array and an array that contains the
> > current level:
> >
> > for ($i = 1; $i <= $maxlevels; $i++)
> > $a1 = ;
> > echo '<option value="' . implode ('|', array_diff ($a,
> > array($i))) .
> > '">Level ' . $i;
> >
> > I'm not 100% that this will work right off the bat, but it should at
> > least put you on the right track... if not out of your misery :-)
> >
> > Hope this helps.
>
> It looks like it might, but I note this warning in the manual
> re:array_diff
>
> Warning
> This was broken in PHP 4.0.4!
>
> http://www.php.net/manual/en/function.array-diff.php
>
> is it fixed in 4.06 do you know? (host uses 4.06, I have 4.2.2)
>
> TIA
>
> Tony
>
>