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

Reply via email to