PHP variables variable not displaying if passed as an array or object -
It works with simple variables, but it shows empty results with complex variables. Or there is no other way thanks.
# $ It works with simple variables $ object = "fruits"; $ Fruit = "banana"; Echo $$ object; // & lt; ------------ Works: Output "banana" echo "\ n"; Rebound $ {"fruit"}; // & lt; ------------ This output "banana" # 2 It does not have complex structure. Am I missing something here? Echo "\ n"; $ Result = array ("node" => (object) array ("id" => 10, "home" => "earth",), "count" => 10, "and_so_on "=> True;); #var_dump ($ result); $ Path = "results ['node'] -> ID"; Echo "\ n"; $$ route echo; // & lt; ---------- This output is empty Output "10" is not required to use variable variable at all, but if you want to use a variable as var, then $ path = "results ['node'] -> ID"; Eval ("echo $". $ Path. ";");
Comments
Post a Comment