note 102273 deleted from function.define by cmb

From: Date: Sun, 06 Oct 2019 07:42:58 +0000
Subject: note 102273 deleted from function.define by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212460@lists.php.net to get a copy of this message
Note Submitter: andreas at cap-systems dot com ---- Constant name must not written as string. The following code works also: <?php define(MY_NAME, 'value'); define('ANOTHER_NAME', 'value2'); if(defined('MY_NAME')) { echo MY_NAME . '<br />'; } if(defined('ANOTHER_NAME')) { echo ANOTHER_NAME . '<br />'; } echo MY_NAME . '<br />'; echo ANOTHER_NAME . '<br />'; ?> Output: value value2 value value2 Tested with: - PHP 5.3.1 on XAMPP on Windows Vista (local) - PHP 5.2.42 on Apache 2.0 on Linux (remote) - PHP 5.2.12 on Apache 2.0 on Linux (remote)

« previous php.notes (#212460) next »