Re: Constants in strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux