3v4l.org

run code in 300+ PHP versions simultaneously
<?php #$str = 'doom2:'; #var_dump(implode(':',explode(':',$str))); exit; $arr = array('var'=> array('sub2' => 'notouch')); function strAssign(&$arr,$str,$val,$trail=true){ if(!empty($str)){ $str = explode(':',$str); $key = array_shift($str); if((isset($arr[$key]) && gettype($arr[$key])!='array') || !isset($arr[$key])){ $arr[$key] = array(); } strAssign($arr[$key],implode(':',$str),$val); }else{ if($trail){ $arr[] = $val; }else{ $arr = $val; } } } strAssign($arr,'var:sub:sub2:','value'); var_dump($arr);
Output for git.master, git.master_jit, rfc.property-hooks
array(1) { ["var"]=> array(2) { ["sub2"]=> string(7) "notouch" ["sub"]=> array(1) { ["sub2"]=> array(1) { [0]=> string(5) "value" } } } }

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:
55.92 ms | 401 KiB | 8 Q