note 114143 added to language.oop5.constants

From: Date: Thu, 16 Jan 2014 11:05:54 +0000
Subject: note 114143 added to language.oop5.constants
Groups: php.notes 
Request: Send a blank email to php-notes+get-198247@lists.php.net to get a copy of this message
I think it's useful if we draw some attention to late static binding here: <?php class A { const MY_CONST = false; public function my_const_self() { return self::MY_CONST; } public function my_const_static() { return static::MY_CONST; } } class B extends A { const MY_CONST = true; } $b = new B(); echo $b->my_const_self ? 'yes' : 'no'; // output: no echo $b->my_const_static ? 'yes' : 'no'; // output: yes ?> ---- Server IP: 72.52.91.14 Probable Submitter: 72.52.91.14 ---- Manual Page -- http://php.net/manual/en/language.oop5.constants.php Edit -- https://master.php.net/note/edit/114143 Del: integrated -- https://master.php.net/note/delete/114143/integrated Del: useless -- https://master.php.net/note/delete/114143/useless Del: bad code -- https://master.php.net/note/delete/114143/bad+code Del: spam -- https://master.php.net/note/delete/114143/spam Del: non-english -- https://master.php.net/note/delete/114143/non-english Del: in docs -- https://master.php.net/note/delete/114143/in+docs Del: other reasons-- https://master.php.net/note/delete/114143 Reject -- https://master.php.net/note/reject/114143 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#198247) next »