note 92786 deleted from language.constants.syntax by cmb
| From: | cmb@php.net | Date: | Sun, 06 Sep 2015 15:37:02 +0000 |
| Subject: | note 92786 deleted from language.constants.syntax by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-203719@lists.php.net to get a copy of this message | ||
Note Submitter: uramihsayibok, gmail, com
----
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;
?>