Is there any way to set an array recursively? something along these lines:
$array = new ArrayElements ( ) ;
$array->set('index', 10)->set('indexInIndex',20);
and then the array would look like this:
Array
(
[index] => Array
(
[0] => 10
[indexInIndex] => 20
)
)
I know it must involve a fluid interface, but the gist of it is how to tell if a method was chained to a method 'set' and then take the index to the previous set setou, and write on top of this index
func_get_args may also have a close and grab all the parameters and set in accordance with the thread, something like
public function set ( $index , $value ) {
if ( func_num_args() > 2 ) {
$indexes = array_splice ( func_get_args() , 2 ) ;
}
}
Then ..
->set( 'index' , 'value' , 'inIndex' , 'inIndex1' )
would be equal to: $storage [ 'inIndex' ] [ 'inIndex1' ] [ 'index' ] = 'value' ;
$array['index']['foo']or$array['index'] = array(10)