3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [10, -1, -1, -1, -1, 15, 16, 17, -1, -1, 20]; $result = []; foreach ($array as $v) { if ($v === -1) { unset($ref); continue; } if (!isset($ref)) { $result[] =& $ref; } $ref[] = $v; } var_export($result);

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.5.30.0100.00819.64
8.5.20.0120.00520.25
8.5.10.0130.00419.80
8.5.00.0160.00819.97
8.4.180.0140.00819.55
8.4.170.0120.01024.01
8.4.160.0080.01524.01
8.4.150.0080.00516.87
8.4.140.0130.00817.39
8.4.130.0070.00317.86
8.4.120.0040.00524.16
8.4.110.0050.00418.79
8.4.100.0150.00517.84
8.4.90.0140.00620.60
8.4.80.0140.00420.86
8.4.70.0100.00820.65
8.4.60.0130.00620.52
8.4.50.0120.00818.52
8.4.40.0130.00617.79
8.4.30.0130.00724.30
8.4.20.0140.00719.54
8.4.10.0160.00319.64
8.3.300.0100.00920.63
8.3.290.0100.01220.83
8.3.280.0090.01118.44
8.3.270.0120.00716.72
8.3.260.0110.00817.03
8.3.250.0110.00519.13
8.3.240.0110.00916.73
8.3.230.0050.00316.74
8.3.220.0040.00420.70
8.3.210.0120.00816.64
8.3.200.0040.00516.73
8.3.190.0050.00318.93
8.3.180.0060.00318.73
8.3.170.0070.01019.12
8.3.160.0090.00919.07
8.3.150.0060.01217.04
8.3.140.0090.00916.55
8.3.130.0050.00316.66
8.3.120.0330.00816.44
8.3.110.0370.01316.39
8.3.100.0440.00716.71
8.3.90.0450.00016.35
8.3.80.0410.00716.38
8.3.70.0350.01016.60
8.3.60.0300.01016.48
8.3.50.0340.00616.72
8.3.40.0300.00917.50
8.3.30.0300.00917.46
8.3.20.0340.00317.53
8.3.10.0120.01817.26
8.3.00.0030.01017.35
8.2.300.0110.00821.96
8.2.290.0090.00617.17
8.2.280.0110.00818.52
8.2.270.0130.00616.55
8.2.260.0070.01117.17
8.2.250.0000.00816.79
8.2.240.0130.00816.63
8.2.230.0310.00616.23
8.2.220.0160.01316.27
8.2.210.0220.00316.27
8.2.200.0200.00316.52
8.2.190.0120.00616.37
8.2.180.0140.00516.72
8.2.170.0190.00017.60
8.2.160.0270.00017.45
8.2.150.0240.00717.32
8.2.140.0390.00417.24
8.2.130.0390.00317.42
8.2.120.0310.01017.54
8.2.110.0280.01417.60
8.2.100.0390.00317.51
8.2.90.0330.00817.59
8.2.80.0410.00017.40
8.2.70.0330.00417.33
8.2.60.0270.01017.47
8.2.50.0340.00617.56
8.2.40.0230.01517.20
8.2.30.0290.01017.44
8.2.20.0240.01417.23
8.2.10.0240.01417.53
8.2.00.0220.01617.30
8.1.340.0140.01623.59
8.1.330.0100.00916.04
8.1.320.0030.00523.60
8.1.310.0070.00718.48
8.1.300.0310.00916.08
8.1.290.0290.01015.89
8.1.280.0290.01115.75
8.1.270.0300.01217.27
8.1.260.0430.00917.25
8.1.250.0260.01117.44
8.1.240.0300.01017.06
8.1.230.0210.01816.99
8.1.220.0210.01016.91
8.1.210.0190.01117.21
8.1.200.0290.00616.86
8.1.190.0210.01616.99
8.1.180.0220.00717.25
8.1.170.0280.00317.32
8.1.160.0220.00717.30
8.1.150.0170.01417.25
8.1.140.0160.01317.09
8.1.130.0190.01117.27
8.1.120.0290.00017.17
8.1.110.0240.00017.12
8.1.100.0130.00417.36
8.1.90.0200.00017.03
8.1.80.0360.00317.35
8.1.70.0320.00417.25
8.1.60.0350.00617.25
8.1.50.0330.00717.46
8.1.40.0300.01017.36
8.1.30.0370.00317.47
8.1.20.0280.00617.46
8.1.10.0360.00417.28
8.1.00.0340.00716.93

preferences:
52.29 ms | 987 KiB | 5 Q