note 109257 deleted from function.defined by googleguy

From: Date: Mon, 17 Sep 2012 13:35:43 +0000
Subject: note 109257 deleted from function.defined by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-190846@lists.php.net to get a copy of this message
Note Submitter: michael at squiloople dot com ---- It should be noted that defined() does not work on magic constants; it will always* return bool(false). However, (re-)defining a magic constant will silently fail. As such the common work-around for defining the __DIR__ magic constant, for example, is unnecessary; it is simply enough to use the following, which will for all intents and purposes be ignored if using PHP 5.3+: <?php define('__DIR__', dirname('__FILE__')); ?> *Using defined() after re-defining a magic constant (which will fail silently) will return bool(true) -- although its value will be the default and not to whatever it was manually set.

« previous php.notes (#190846) next »