note 92786 added to language.constants.syntax

From: Date: Sun, 09 Aug 2009 06:54:26 +0000
Subject: note 92786 added to language.constants.syntax
Groups: php.notes 
Request: Send a blank email to php-notes+get-159225@lists.php.net to get a copy of this message
Don't let the comparison between const (in the global context) and define() confuse you: while define() allows expressions as the value, const does not. In that sense it behaves exactly as const (in class context) does. <?php // this works /** * Path to the root of the application */ define("PATH_ROOT", dirname(__FILE__)); // this does not /** * Path to configuration files */ const PATH_CONFIG = PATH_ROOT . "/config"; // this does /** * Path to configuration files - DEPRECATED, use PATH_CONFIG */ const PATH_CONF = PATH_CONFIG; ?> ---- Server IP: 69.147.83.197 Probable Submitter: 75.172.113.148 ---- Manual Page -- http://www.php.net/manual/en/language.constants.syntax.php Edit -- https://master.php.net/note/edit/92786 Del: integrated -- https://master.php.net/note/delete/92786/integrated Del: useless -- https://master.php.net/note/delete/92786/useless Del: bad code -- https://master.php.net/note/delete/92786/bad+code Del: spam -- https://master.php.net/note/delete/92786/spam Del: non-english -- https://master.php.net/note/delete/92786/non-english Del: in docs -- https://master.php.net/note/delete/92786/in+docs Del: other reasons-- https://master.php.net/note/delete/92786 Reject -- https://master.php.net/note/reject/92786 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#159225) next »