I have a language files containing constants like.
define("CONTINUE", "Continue");
then in database I have a form with
<input type=submit name=submit value="[CONTINUE]">
when it is fetched from db I want to output it on html so I should replace [CONTINUE] with the constant
variable that it outputs the constant value. I don't like to use eval() so I have this:
preg_match_all('/[(\w+)]/', $from_database, $matches);
if( ! empty($matches[1]) ) foreach($matches[1] as $match){
if( defined($match) ){
$from_database = str_replace("[$match]", constant($match), $from_database);
}
}
echo $from_database;
but it doesn't work, can anyone help?