RE: [PHP-WIN] Undefined Constant error Anybody Help?

From: Date: Mon, 05 Aug 2002 01:01:09 +0000
Subject: RE: [PHP-WIN] Undefined Constant error Anybody Help?
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-15113@lists.php.net to get a copy of this message
put the array key names in quotes... 'Code' => "TIR" etc etc -----Original Message----- From: Sean M. Mayhew [mailto:sean@heliocreative.com] Sent: 03 August 2002 13:28 To: php-windows@lists.php.net Subject: [PHP-WIN] Undefined Constant error Anybody Help? Can anyone tell me why the following php code produces the errors below $products = array(array(Code => "TIR", Description => "Tires", price => 100), array (Code => "OIL", Description => "Oil", price => 10), array (Code => "SPK", Description => "Spark Plugs", price => 4) ); for ($row = 0; $row < 3; $row++) { while (list($key, $value) = each ($products[$row])) { echo "|$value"; } echo "|<br>"; } ERROR RESULTS Warning: Use of undefined constant Code - assumed 'Code' in c:/apache/apache/htdocs/www/testsite/multiarray.php on line 24 Warning: Use of undefined constant Description - assumed 'Description' in c:/apache/apache/htdocs/www/testsite/multiarray.php on line 24 Warning: Use of undefined constant price - assumed 'price' in c:/apache/apache/htdocs/www/testsite/multiarray.php on line 24 Warning: Use of undefined constant Code - assumed 'Code' in c:/apache/apache/htdocs/www/testsite/multiarray.php on line 25 Warning: Use of undefined constant Description - assumed 'Description' in c:/apache/apache/htdocs/www/testsite/multiarray.php on line 25 Warning: Use of undefined constant price - assumed 'price' in c:/apache/apache/htdocs/www/testsite/multiarray.php on line 25 Warning: Use of undefined constant Code - assumed 'Code' in c:/apache/apache/htdocs/www/testsite/multiarray.php on line 26 Warning: Use of undefined constant Description - assumed 'Description' in c:/apache/apache/htdocs/www/testsite/multiarray.php on line 26 Warning: Use of undefined constant price - assumed 'price' in c:/apache/apache/htdocs/www/testsite/multiarray.php on line 26 -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.windows (#15113) next »