i would like to ask, how to make variables from the array, where some variables are variables and some arrays.
for ex: i have an array for global:
$globals = array("routes","_ARGS","DB_SERVER","DB_USER","DB_PASS","DB_NAME","conn","mysql_tables","validity_of_fields_array");
and one of the variable is array "validity_of_fields_array"
.
so i made a code that if some variable ends with word array, the script sets the variable an array instead just a variable
function framework_routes($rout_arg){
global $globals;
foreach($globals as $value) {
if(substr($value, count($value)-6) == strtolower("array")){
global $$value = array;
} else {
global $$value;
}
}
this part (global $$value;
) sets the variable ok, but this part (global $$value = array;
) throws me an error!
if i set global $$value[];
instead of global $$value = array;
it throws me an error too.
May be someone knows how to for-each variables from an array, when some of variables are arrays?
Thank you and have a nice day !
Justin