3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @author Iltar van der Berg * @version 2.0.0 */ class RecursiveArrayObject extends ArrayObject { /** * overwrites the ArrayObject constructor for * iteration through the "array". When the item * is an array, it creates another self() instead * of an array * * @param Array $array data array */ public function __construct(Array $array) { foreach($array as $key => $value) { if(is_array($value)){ $value = new static($value); } $this->offsetSet($key, $value); } } /** * returns Array when printed (like "echo array();") * instead of an error * * @return string */ public function __ToString() { return 'Array'; } } $array = array('1','2','3,'); $array = new RecursiveArrayObject($array); print_r($array);
Output for git.master, git.master_jit, rfc.property-hooks
RecursiveArrayObject Object ( [storage:ArrayObject:private] => Array ( [0] => 1 [1] => 2 [2] => 3, ) )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
38.77 ms | 401 KiB | 8 Q