manipulating constant name as string

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

 



Hello

I am trying to access the constant name as string and not the constant contents. For example,

define('myconst', 'const text 1');

$myArray = array()

myArray['myconst'] = "this is it"
etc.

$xmltext="";
foreach ($myArray as $key => $val) {
   echo "$key = $val\n\n";
   $xmltext .= "$xmltext = $xmltext . "<$key> $val </$key>";
}

Unfortunately, $key within the string concatenation is translated into the constant value. However, for the echo statement, then $key constant name is displayed. Is there a way to keep the constant name rather its value when manipulating it as a string?

thanks,

Daniel

--
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