fork(2) download
  1. <?php
  2.  
  3. class ArrayWrapper extends ArrayObject {
  4. public function offsetSet($offset, $value) {
  5. parent::offsetSet($offset, is_array($value) ? new ArrayWrapper($value) : $value);
  6. }
  7. }
  8.  
  9. $a = new ArrayWrapper();
  10. $a['b'] = array('c'=>array('d'));
  11. print_r($a);
  12. unset($a['b']['c']);
  13. print_r($a);
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
ArrayWrapper Object
(
    [b] => ArrayWrapper Object
        (
            [c] => Array
                (
                    [0] => d
                )

        )

)
ArrayWrapper Object
(
    [b] => ArrayWrapper Object
        (
        )

)