[thelist] best way to do dynamic tabs in PHP
Rich Gray
rich at f1central.net
Wed Jan 22 08:40:01 CST 2003
how about using the break statement?
http://www.php.net/break
Rich
-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of noah
Sent: 22 January 2003 10:19
To: thelist at lists.evolt.org; thelist at lists.evolt.org
Subject: RE: [thelist] best way to do dynamic tabs in PHP
At 09:57 PM 21/01/2003, Aleem Bawany wrote:
>$pages = array("one.php", "two.php", ..., "six.php");
>foreach ($pages as $page) {
> if ($page != $currpage)
> // code for regular link
> else
> // code for current link
>}
This brings to mind an issue that's occurred to me before, but that I don't
have the PHP skills to deal with:
If ($currpage == "one.php"), there's no need to test the rest of the
elements in that array (i.e., once a page is matched, any ensuing pages
won't match). Is there any way of stopping the foreach loop once the
current page is matched, and then printing out the remaining elements in
the array as regular links without having to test them against $currpage?
Cheers,
Noah
More information about the thelist
mailing list