fork download
  1. <?php
  2.  
  3.  
  4. $example = array(
  5. 'foo' => array(
  6. 'hello' => array(
  7. 'world' => '!',
  8. 'earth' => '?'
  9. )
  10. ),
  11. 'bar' => array());
  12. // your code goes here
  13.  
  14. $yourVar = null;
  15. $access = "['foo']['hello']['world']";
  16.  
  17. $actualAccesEvalCode = '$yourVar = $example'.$access.';';
  18.  
  19. eval($actualAccesEvalCode);
  20.  
  21. echo 'YourVal now is '.$yourVar;
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
YourVal now is !