[ create a new paste ] login | about

Link: http://codepad.org/EswThZsV    [ raw code | output | fork ]

PHP, pasted on Nov 2:
1
2
3
4
5
6
7
8
<?php
 $path = "['Breaks'][1]['In']";
$path_arr = explode(']', str_replace(array("['", "'", "["), '', $path)); 

$array[$path_arr[0]][$path_arr[1]][$path_arr[2]] = "XXX";
var_dump($array);
 
?>


Output:
1
2
3
4
5
6
7
8
9
10
array(1) {
  ["Breaks"]=>
  array(1) {
    [1]=>
    array(1) {
      ["In"]=>
      string(3) "XXX"
    }
  }
}


Create a new paste based on this one


Comments: