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"; $tempArr = explode('.', $path); $results = array(); $arrStr = '$results'; $value = 'testing'; foreach( $tempArr as $ky=>$val) { $arrStr .= "['".$val."']"; ( $ky == count($tempArr) - 1 ) ? $arrStr .= ' = $value;' : ''; } eval($arrStr); print_r($results); ?>
Private
[
?
]
Run code
Submit