Each() behaving different with PHP 4.1.2
| From: | Greg Breland | Date: | Sun, 03 Mar 2002 06:24:40 +0000 |
| Subject: | Each() behaving different with PHP 4.1.2 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-86957@lists.php.net to get a copy of this message | ||
I recently upgraded my site from PHP 4.0.6 to PHP 4.1.2. The following
bit of code quit working:
static $navigationLinks = array (
"index.php3" => "News",
"download.php3" => "Download",
"links.php3" => "Links",
"archived_news.php3" => "News Archives" );
echo " <div style=\"border-style:solid;\">\n";
echo " <ul>\n";
while( list( $link, $label) = each( $navigationLinks ) ) {
echo "<li";
if( $PHP_SELF == $link ) echo " class=\"currentPage\"";
echo "><a
href=\"".$link."\">".$label."</a></li>\n";
}
echo " </ul>\n";
echo " </div>\n";
If $navigationLinks is NOT declared as "static", then the code will work
with PHP 4.1.2. It works both ways with 4.0.6. Just an FYI and
wondering if anyone knows why?
Greg Breland