fork download
  1. <?php
  2. $b = ['a', 'b', 'c',];
  3. $a = [];
  4. $tmp = &$a;
  5. foreach($b as $v) {
  6. $tmp[$v] = [];
  7. $tmp = &$tmp[$v];
  8. }
Success #stdin #stdout 0.04s 82560KB
stdin
Standard input is empty
stdout
array(1) {
  ["a"]=>
  array(1) {
    ["b"]=>
    array(1) {
      ["c"]=>
      &array(0) {
      }
    }
  }
}