I want to be able to generate some constants from an array. So something like this:
foreach ($array as $key => $value) {
define($key,$value);
}
Is there a simple way to do this?
I want to be able to generate some constants from an array. So something like this:
foreach ($array as $key => $value) {
define($key,$value);
}
Is there a simple way to do this?
You're already doing this in your code. Or d you mean like this?
$array = array("sparkles" => "pretty");
foreach($array as $key=>$value) {
${$key} = $value;
}
echo $sparkles; //pretty