codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?php $path = "group1.group2.group3.element"; $value = 55; $x = explode(".",$path); $result = Array(); $last = &$result; foreach ($x as $elem) { $last[$elem] = Array(); $last = &$last[$elem]; } $last = $value; echo("<pre>$path=$value"); print_r($result); ?>
Private
[
?
]
Run code
Submit