You are here: manipulating constant name as string « PHP « IT news, forums, messages
manipulating constant name as string

Posted by Daniel Gross on 01/01/06 20:37

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация