3v4l.org

run code in 300+ PHP versions simultaneously
<?php $combined = array( 'A' => array( 'B' => array( 'C' => array(null, null), ), 'D' => array( 'K' => array(null, null), ) ), ); $stack = array(&$combined); while (null !== ($ptr = &array_pop($stack))) { $null_count = 0; foreach ($ptr as $key => $value) { if (is_array($value)) { $stack[] = &$ptr[$key]; } elseif (null === $value) { ++$null_count; } } if (count($ptr) === $null_count) { $ptr = null; } } print_r($combined);
Output for git.master, git.master_jit, rfc.property-hooks
Notice: Only variables should be assigned by reference in /in/7Oh09 on line 14 Notice: Only variables should be assigned by reference in /in/7Oh09 on line 14 Notice: Only variables should be assigned by reference in /in/7Oh09 on line 14 Notice: Only variables should be assigned by reference in /in/7Oh09 on line 14 Notice: Only variables should be assigned by reference in /in/7Oh09 on line 14 Notice: Only variables should be assigned by reference in /in/7Oh09 on line 14 Notice: Only variables should be assigned by reference in /in/7Oh09 on line 14 Array ( [A] => Array ( [B] => Array ( [C] => Array ( [0] => [1] => ) ) [D] => Array ( [K] => Array ( [0] => [1] => ) ) ) )

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:
44.8 ms | 403 KiB | 8 Q