So Im looking for way to convert string into var... I need do get data from array $Map As key I use $URL that get data from real URL and seperate it... $URL = explode("/",$URL); So when I access values of $Map it need to be written like this:
$Map[$URL[0]][$URL[1]][$URL[2]][$URL[3]][$URL[4]][$URL[5]]
So I decide to create function that generate amount of [$URL[0]]'s like
function GenerateURl($i){for ($x = 0; $x <= $i; $x++){
$URls.='$URL['.$x.']';
}
return($URls);}
Why? I have map of pages that can host visit , thats what $MAP contains, each dimension has style and content setting, but I really dont want to type every single dimension manually + its pain to maintace it...
if($Map[$URL[0]){ #Check if first dimension exist (Index.php/example)
if....... #this take much more steps to verify if there is request for child, and if child exist, ofc there is else method that redirect to closest parent page
$Style="style_for_page.css";
$Contend="style_for_page.css";
}
else{
header("Location: https://example.com");
}
I dont know what I do wrong... But when I call my function GenerateURl(5) output is string... not working var... so its like
$URL[0]$URL[1]$URL[2]$URL[3]$URL[4]
and not like
Profile User Settings Privacy Examle...... (example.com/Profile/User/Settings/Privacy/Examle)
Update: To simplify my question... I need this:
$MAP = array(........) ;
$URL = array("example");
$var = "[$URl[0]]"; #$URL need to be transferred as text to print part
Print($Map[$var]);