3v4l.org

run code in 300+ PHP versions simultaneously
<?php $raw = array( 'firstname' => 'Foo', 'lastname' => 'Bar', 'nickname' => '', 'birthdate' => [ 'day' => '', 'month' => '', 'year' => '', ], 'likes' => [ 'cars' => ['Subaru Impreza WRX STi', 'Mitsubishi Evo', 'Nissan GTR'], 'bikes' => [], ], 'zero' => 0, 'deeper' => [ 'zeroString' => '0', 'null' => null ], 'false' => false, ); function recursivelyRemoveEmpties(array $array): array { foreach ($array as $key => &$value) { if (is_array($value)) { $value = recursivelyRemoveEmpties($value); if (!$value) { unset($array[$key]); } continue; } if ($value === '') { unset($array[$key]); } } return $array; } var_export(recursivelyRemoveEmpties($raw));

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)
8.4.140.0130.00817.64
8.4.130.0100.01019.59
8.4.120.0100.01020.59
8.4.110.0110.00922.34
8.4.100.0130.00717.84
8.4.90.0090.00718.76
8.4.80.0060.00219.52
8.4.70.0130.00717.84
8.4.60.0060.00222.30
8.4.50.0100.00618.75
8.4.40.0190.00319.30
8.4.30.0100.01018.79
8.4.20.0120.00617.73
8.4.10.0000.00923.81
8.3.270.0130.00616.59
8.3.260.0110.00716.60
8.3.250.0110.00718.97
8.3.240.0120.00817.08
8.3.230.0130.00816.54
8.3.220.0110.00917.37
8.3.210.0030.00416.70
8.3.200.0060.00316.54
8.3.190.0030.00817.32
8.3.180.0120.00716.66
8.3.170.0070.01018.94
8.3.160.0090.00917.05
8.3.150.0070.00317.29
8.3.140.0040.00416.56
8.3.130.0080.00018.42
8.3.120.0120.00318.77
8.3.110.0080.00020.94
8.3.100.0050.00324.06
8.3.90.0070.00026.77
8.3.80.0030.00618.40
8.3.70.0000.01716.63
8.3.60.0070.00716.63
8.3.50.0040.01116.60
8.3.40.0160.00020.04
8.3.30.0030.01318.89
8.3.20.0080.00024.18
8.3.10.0040.00424.66
8.3.00.0050.00226.16
8.2.290.0100.00820.48
8.2.280.0120.00620.26
8.2.270.0090.00916.63
8.2.260.0060.00318.16
8.2.250.0050.00318.37
8.2.240.0130.00618.29
8.2.230.0170.00322.58
8.2.220.0090.00037.54
8.2.210.0060.00326.77
8.2.200.0030.00616.75
8.2.190.0070.00716.88
8.2.180.0140.00716.88
8.2.170.0120.00318.92
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0080.00020.83
8.2.110.0100.00019.29
8.2.100.0030.00917.91
8.2.90.0000.00919.27
8.2.80.0060.00617.97
8.2.70.0040.00417.61
8.2.60.0030.00617.63
8.2.50.0030.00619.23
8.2.40.0120.00317.75
8.2.30.0120.00417.72
8.2.20.0100.00617.72
8.2.10.0150.00017.72
8.2.00.0130.00317.72
8.1.330.0120.00622.21
8.1.320.0140.00516.27
8.1.310.0070.00716.16
8.1.300.0080.00018.42
8.1.290.0090.00030.84
8.1.280.0090.00625.92
8.1.270.0060.00323.77
8.1.260.0050.00326.35
8.1.250.0000.00828.09
8.1.240.0000.00923.97
8.1.230.0070.00417.95
8.1.220.0030.00617.79
8.1.210.0030.00518.77
8.1.200.0030.00717.48
8.1.190.0060.00317.22
8.1.180.0060.00318.10
8.1.170.0120.00317.72
8.1.160.0060.00917.72
8.1.150.0100.00517.72
8.1.140.0060.00917.72
8.1.130.0130.00317.72
8.1.120.0100.00517.72
8.1.110.0110.00417.72
8.1.100.0150.00017.72
8.1.90.0070.00717.72
8.1.80.0100.00617.72
8.1.70.0150.00317.72
8.1.60.0090.00917.72
8.1.50.0130.00617.72
8.1.40.0140.00417.72
8.1.30.0170.00017.72
8.1.20.0130.00417.72
8.1.10.0140.00517.72
8.1.00.0180.00017.72
8.0.300.0040.00418.77
8.0.290.0070.00016.63
8.0.280.0110.00517.72
8.0.270.0180.00017.72
8.0.260.0090.00617.72
8.0.250.0080.00817.72
8.0.240.0090.00617.72
8.0.230.0060.01017.72
8.0.220.0150.00017.72
8.0.210.0000.01617.72
8.0.200.0120.00417.72
8.0.190.0110.00417.72
8.0.180.0110.00417.72
8.0.170.0120.00217.72
8.0.160.0070.00717.72
8.0.150.0140.00217.72
8.0.140.0110.00417.72
8.0.130.0150.00017.72
8.0.120.0070.00717.72
8.0.110.0100.00517.72
8.0.100.0110.00517.72
8.0.90.0100.00617.72
8.0.80.0140.00517.72
8.0.70.0100.00517.72
8.0.60.0110.00517.72
8.0.50.0000.01617.72
8.0.30.0150.00017.72
8.0.20.0150.00017.72
8.0.10.0120.00517.72

preferences:
28.79 ms | 403 KiB | 5 Q