Bug #10022 Updated: Constants not handled in arrays defined in class declaration

From: Date: Wed, 27 Jun 2001 06:09:34 +0000
Subject: Bug #10022 Updated: Constants not handled in arrays defined in class declaration
Groups: php.dev 
Request: Send a blank email to php-dev+get-58151@lists.php.net to get a copy of this message
ID: 10022 Updated by: danbeck Reported By: cri@mindpass.com Old-Status: Analyzed Status: Closed Bug Type: Documentation problem Operating system: PHP Version: 4.0.4pl1 Assigned To: Comments: This is already explained in http://www.php.net/manual/en/language.oop.php, but I did go ahead and add an example of using array() in the list of things that won't work. Previous Comments: --------------------------------------------------------------------------- [2001-03-27 10:26:36] sniper@php.net Check the last user entry on this page: http://www.php.net/manual/en/language.constants.php Reclassified as documentation problem. --Jani --------------------------------------------------------------------------- [2001-03-27 09:54:03] cri@mindpass.com <?php // // The following produces a warning // error_reporting(15); define("A", 1); define("B", 2); define("C", 3); class Example { var $hash = array(A => "test1", B => "test2", C => "test3"); var $otherHash; function Example() { $this->otherHash = array(A => "test1", B => "test2", C => "test3"); } } $example = new Example; echo "<hr>Trying $example->hash[B]:<br>"; echo $example->hash[B]; echo "<hr>Trying $example->otherHash[B]<br>"; echo $example->otherHash[B]; echo "<hr>Dump of $example->hash<br>"; print_r($example->hash); echo "<hr>Dump of $example->otherHash<br>"; print_r($example->otherHash); ?> --------------------------------------------------------------------------- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=10022&edit=2

« previous php.dev (#58151) next »