note 118044 deleted from function.define by cmb

From: Date: Sun, 06 Oct 2019 07:55:57 +0000
Subject: note 118044 deleted from function.define by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212485@lists.php.net to get a copy of this message
Note Submitter: fernandopsilveira at yahoo dot com dot br ---- Just like define(), defined() will check for constants exactly as specified. So, if you want to check a constant in a namespace, you will need to specify the namespace in your call to defined(), even if you're calling defined() from within a namespace. To check for a defined constant within current namespace, you can use __NAMESPACE__ magic variable: <?php namespace mytest; define('mytest\CONSTANTINE', 'value'); if (defined(__NAMESPACE__ . '\CONSTANTINE')) { print "Constant is defined and is valued " . CONSTANTINE; } ?>

« previous php.notes (#212485) next »