Re: Each() behaving different with PHP 4.1.2

From: Date: Sun, 03 Mar 2002 09:32:17 +0000
Subject: Re: Each() behaving different with PHP 4.1.2
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-86964@lists.php.net to get a copy of this message
Greg Breland wrote:
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
Create shortest & complete script and submit this bug with the script. I don't notice this bug nor bug report, but make sure you search bug db for the same bug. -- Yasuo Ohgaki

« previous php.general (#86964) next »