note 118998 added to language.oop5.constants

From: Date: Tue, 15 Mar 2016 08:50:59 +0000
Subject: note 118998 added to language.oop5.constants
Groups: php.notes 
Request: Send a blank email to php-notes+get-205163@lists.php.net to get a copy of this message
Note, as of PHP7 it is possible to define class constants with an array. <?php class MyClass { const ABC = array('A', 'B', 'C'); const A = '1'; const B = '2'; const C = '3'; const NUMBERS = array( self::A, self::B, self::C, ); } var_dump(MyClass::ABC); var_dump(MyClass::NUMBERS); // Result: /* array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "C" } array(3) { [0]=> string(1) "1" [1]=> string(1) "2" [2]=> string(1) "3" } */ ?> ---- Server IP: 72.52.91.14 Probable Submitter: 87.150.149.8 ---- Manual Page -- http://php.net/manual/en/language.oop5.constants.php Edit -- https://master.php.net/note/edit/118998 Del: integrated -- https://master.php.net/note/delete/118998/integrated Del: useless -- https://master.php.net/note/delete/118998/useless Del: bad code -- https://master.php.net/note/delete/118998/bad+code Del: spam -- https://master.php.net/note/delete/118998/spam Del: non-english -- https://master.php.net/note/delete/118998/non-english Del: in docs -- https://master.php.net/note/delete/118998/in+docs Del: other reasons-- https://master.php.net/note/delete/118998 Reject -- https://master.php.net/note/reject/118998 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#205163) next »