[thelist] best way to do dynamic tabs in PHP

noah noah at tookish.net
Wed Jan 22 04:20:00 CST 2003

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?


More information about the thelist mailing list