RE: [PHP] Logic headache, please help.

2002-11-11 Thread Marco Tabini
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 '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
> 
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Logic headache, please help.

2002-11-11 Thread Tony Crockford




> -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 '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



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Logic headache, please help.

2002-11-11 Thread Marco Tabini
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 '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.


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 09:48, Tony Crockford wrote:
> Hi all,
> 
> brief explanation:
> 
> I'm building a select list, to exclude certain directories from a search
> (with Ht://dig).
> 
> The structure is like this:
> 
> All levels
> Level 1
> Level 2
> Level 3
> Level 4
> 
> 
> for four levels, where the option value should be all lv's except the
> current option level.
> 
> I have a variable $maxlevels to count up to however many levels are
> required and  I want to make this select list work based on the value of
> $maxlevels.
> 
> How would you approach the building of the list?
> 
> I was going to use a while loop or two, but I'm stuck at the point of
> creating the value "string" which should contain all the levels from 1
> to $maxlevels except the current level. which would seem to require some
> sort of conditional "if $thislevel string is" type of approach, but I
> can't get my head round it.
> 
> Anyone put me out of my misery?
> 
> Thanks
> 
> Tony
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php