Re: Constants in strings
| From: | Curtis Maurand | Date: | Wed, 06 Jul 2011 11:19:19 +0000 |
| Subject: | Re: Constants in strings | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-313943@lists.php.net to get a copy of this message | ||
On 7/6/2011 7:07 AM, Dave Wilson wrote:
Output - {XYZ} Attempt 2: <?php define ('XYZ','ABC'); echo "{{XYZ}}\n"; ?> Output - {{XYZ}} No luck there. I did encounter one oddity though: <?php define ('XYZ','ABC'); echo "{${XYZ}}\n"; ?> Output: PHP Notice: Undefined variable: ABC in /home/wilsond/testScripts/l7.php on line 3 Which appears to mean that PHP is able to pick up the value of the constant and try to access a variable with that name. Any ideas? echo XYZ . "\n";--Curtis