note 109855 added to language.constants

From: Date: Tue, 28 Aug 2012 14:17:56 +0000
Subject: note 109855 added to language.constants
Groups: php.notes 
Request: Send a blank email to php-notes+get-190246@lists.php.net to get a copy of this message
const works in the global scope as well (at least in PHP 5.3.3). Seems it didn't work in 5.2, but has since been fixed. :) <?php const GREETING = "Hello, world!\n"; echo GREETING; ?> Still can't use it in functions...but it does work in files *included* from functions. So that script above? If you had a function that included it, it would still work -- and GREETING would be visible to the rest of the app after the include. ---- Server IP: 69.147.83.197 Probable Submitter: 66.255.131.11 ---- Manual Page -- http://www.php.net/manual/en/language.constants.php Edit -- https://master.php.net/note/edit/109855 Del: integrated -- https://master.php.net/note/delete/109855/integrated Del: useless -- https://master.php.net/note/delete/109855/useless Del: bad code -- https://master.php.net/note/delete/109855/bad+code Del: spam -- https://master.php.net/note/delete/109855/spam Del: non-english -- https://master.php.net/note/delete/109855/non-english Del: in docs -- https://master.php.net/note/delete/109855/in+docs Del: other reasons-- https://master.php.net/note/delete/109855 Reject -- https://master.php.net/note/reject/109855 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#190246) next »