3v4l.org

run code in 300+ PHP versions simultaneously
<?php $combined = array( 'A' => array( 'B' => array( 'C' => array(1, null), ), 'D' => array( 'K' => array(null, null), ) ), ); function _nullifyEmpty(array $array) { $nulls = 0; foreach ($array as $key => $value) { if (is_array($value)) { $array[$key] = self::_nullifyEmpty($value); } elseif (null === $value) { ++$nulls; } } if ($nulls === count($array)) { return null; } return $array; } print_r(_nullifyEmpty($combined));

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.5.50.0030.04320.14
5.5.40.0130.04320.06
5.5.30.0200.06720.03
5.5.20.0070.08720.11
5.5.10.0030.08020.13
5.5.00.0070.07320.02
5.4.210.0070.04719.22
5.4.200.0070.08319.02
5.4.190.0070.04319.02
5.4.180.0100.07719.04
5.4.170.0070.07719.15
5.4.160.0030.08019.14
5.4.150.0200.06019.03
5.4.140.0030.05016.27
5.4.130.0070.04016.45
5.4.120.0030.04716.42
5.4.110.0030.04716.32
5.4.100.0100.07716.50
5.4.90.0070.05716.51
5.4.80.0170.06316.50
5.4.70.0030.07716.48
5.4.60.0070.05016.32
5.4.50.0030.07316.39
5.4.40.0100.05716.44
5.4.30.0030.07016.36
5.4.20.0030.07716.40
5.4.10.0070.07316.51
5.4.00.0130.06715.85
5.3.270.0130.07014.65
5.3.260.0070.04714.55
5.3.250.0130.06714.66
5.3.240.0070.05314.60
5.3.230.0130.07314.54
5.3.220.0130.07714.68
5.3.210.0000.07714.70
5.3.200.0130.06714.54
5.3.190.0070.07314.63
5.3.180.0030.06314.54
5.3.170.0030.07714.59
5.3.160.0070.04714.59
5.3.150.0130.06314.70
5.3.140.0030.08014.61
5.3.130.0100.07314.47
5.3.120.0170.05014.49
5.3.110.0030.06014.65
5.3.100.0230.06314.07
5.3.90.0100.06714.07
5.3.80.0100.07714.13
5.3.70.0070.05014.08
5.3.60.0100.07014.02
5.3.50.0100.07714.01
5.3.40.0100.07014.00
5.3.30.0030.06313.89
5.3.20.0070.06713.71
5.3.10.0030.07313.64
5.3.00.0070.07713.65
5.2.170.0030.06711.62
5.2.160.0000.05711.62
5.2.150.0000.04311.62
5.2.140.0070.06011.62
5.2.130.0030.06011.62
5.2.120.0070.05311.62
5.2.110.0070.05711.62
5.2.100.0000.04711.62
5.2.90.0070.05711.62
5.2.80.0070.06011.62
5.2.70.0030.06311.62
5.2.60.0030.06311.62
5.2.50.0030.05711.62
5.2.40.0070.03711.62
5.2.30.0000.05311.62
5.2.20.0000.07011.62
5.2.10.0170.04011.62
5.2.00.0030.06011.62
5.1.60.0070.05011.62
5.1.50.0030.05711.62
5.1.40.0100.04711.62
5.1.30.0100.05011.62
5.1.20.0100.05011.62
5.1.10.0130.05011.62
5.1.00.0000.05711.62
5.0.50.0130.02011.62
5.0.40.0000.04711.62
5.0.30.0030.06711.62
5.0.20.0030.04311.62
5.0.10.0030.02311.62
5.0.00.0000.04311.62
4.4.90.0030.03711.62
4.4.80.0000.04011.62
4.4.70.0000.03311.62
4.4.60.0030.02311.62
4.4.50.0070.03011.62
4.4.40.0000.04311.62
4.4.30.0130.02711.62
4.4.20.0100.02311.62
4.4.10.0000.02711.62
4.4.00.0000.05311.62
4.3.110.0000.03711.62
4.3.100.0070.03011.62
4.3.90.0030.03311.62
4.3.80.0030.05311.62
4.3.70.0030.01711.62
4.3.60.0030.01711.62
4.3.50.0030.03311.62
4.3.40.0030.03711.62
4.3.30.0000.03711.62
4.3.20.0000.03711.62
4.3.10.0000.03011.62
4.3.00.0030.03311.62

preferences:
138.17 ms | 1394 KiB | 7 Q