note 111261 added to function.constant

From: Date: Thu, 31 Jan 2013 11:57:46 +0000
Subject: note 111261 added to function.constant
Groups: php.notes 
Request: Send a blank email to php-notes+get-193462@lists.php.net to get a copy of this message
As of PHP 5.4.6 constant() pays no attention to any namespace aliases that might be defined in the file in which it's used. I.e. constant() always behaves as if it is called from the global namespace. This means that the following will not work: <?php class Foo { const BAR = 42; } ?> <?php namespace Baz; use \Foo as F; echo constant('F::BAR'); ?> However, calling constant('Foo::BAR') will work as expected. ---- Server IP: 69.147.83.199 Probable Submitter: 86.135.78.81 ---- Manual Page -- http://php.net/manual/en/function.constant.php Edit -- https://master.php.net/note/edit/111261 Del: integrated -- https://master.php.net/note/delete/111261/integrated Del: useless -- https://master.php.net/note/delete/111261/useless Del: bad code -- https://master.php.net/note/delete/111261/bad+code Del: spam -- https://master.php.net/note/delete/111261/spam Del: non-english -- https://master.php.net/note/delete/111261/non-english Del: in docs -- https://master.php.net/note/delete/111261/in+docs Del: other reasons-- https://master.php.net/note/delete/111261 Reject -- https://master.php.net/note/reject/111261 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#193462) next »