0

I've been trying to do this all evening and I haven't been able to get it to work.

I'm pulling strings of text from my database that contain other PHP constants and trying to define the whole thing as a constant, showing the code is probably easier than explaining it:

foreach($dalResponse->contents as $thisConfigItem){
    define($thisConfigItem['contentTag'],$thisConfigItem[LANGUAGE_DEFAULT]);
}

In this example The contents of $thisConfigItem['contentTag'] is WELCOME and the contentsd of $thisConfigItem[LANGUAGE_DEFAULT] is "Welcome to SITE_NAME". SITE_NAME is a previously defined constant with the value "thisSite".

I would like the constant WELCOME to contain "Welcome to thisSite".

Is this possible?

Cheers Andy

1 Answers1

0

If you are trying to use the value of the variable, try using variables variable:

http://php.net/manual/en/language.variables.variable.php

Mr Wednesday
  • 552
  • 4
  • 16