3v4l.org

run code in 300+ PHP versions simultaneously
<?php $temp = array ( 0 => array( 0 => "a" ), 1 => array( 0 => "b", 1 => "c" ), "a" => array( "b" => "d" ) ); echo "<pre>"; print_r($arr); $new_arr = array(); foreach ($temp as $key => $value) { if(count($value)>1) $new_arr[$key] = $value; else { $new_arr[$key] = $value[0]; } } print_r($new_arr);
Output for git.master, git.master_jit, rfc.property-hooks
<pre> Warning: Undefined variable $arr in /in/3EfEN on line 15 Warning: Undefined array key 0 in /in/3EfEN on line 23 Array ( [0] => a [1] => Array ( [0] => b [1] => c ) [a] => )

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:
70.05 ms | 402 KiB | 8 Q