3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [-5, 1, 2, 3, 10, 11, 12, 13, 14, 23, 24, 25, 31]; for ($i = 1, $count = count($array); $i < $count; ++$i) { // deliberately re-count the array because array_splice() extends the array if (($array[$i - 1] + 1) != $array[$i]) { // there is a gap between consecutive comparable values array_splice($array, $i++, 0, 'xxx'); // inject new element in gap, then bump counter to avoid injected element ++$count; } } var_export($array);

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.120.0120.00723.96
8.4.110.0090.01022.49
8.4.100.0080.00318.64
8.4.90.0120.00618.75
8.4.80.0100.00820.52
8.4.70.0040.00417.95
8.4.60.0070.00518.64
8.4.50.0140.00620.39
8.4.40.0070.01117.66
8.4.30.0160.00318.80
8.4.20.0150.00419.54
8.4.10.0060.00319.43
8.3.250.0120.00818.75
8.3.240.0110.00717.30
8.3.230.0060.00316.57
8.3.220.0120.00418.84
8.3.210.0160.00316.64
8.3.200.0100.01016.38
8.3.190.0090.01017.06
8.3.180.0030.00517.19
8.3.170.0070.01120.61
8.3.160.0120.00617.02
8.3.150.0090.00917.05
8.3.140.0130.00616.57
8.3.130.0040.00416.54
8.3.120.0030.00620.91
8.3.110.0060.00316.73
8.3.100.0050.00516.61
8.3.90.0110.00416.73
8.3.80.0060.00317.97
8.3.70.0120.00616.75
8.3.60.0120.00618.34
8.3.50.0070.01116.47
8.3.40.0350.00819.30
8.3.30.0320.00018.98
8.3.20.0140.00721.89
8.3.10.0140.00621.66
8.3.00.0310.00418.85
8.2.290.0080.00720.45
8.2.280.0140.00818.32
8.2.270.0110.00717.16
8.2.260.0140.00416.72
8.2.250.0130.00618.09
8.2.240.0100.00617.18
8.2.230.0030.00620.94
8.2.220.0060.00324.06
8.2.210.0080.00026.77
8.2.200.0080.00018.29
8.2.190.0110.01116.73
8.2.180.0110.01116.75
8.2.170.0390.00618.58
8.2.160.0310.00720.19
8.2.150.0210.01019.15
8.2.140.0140.00720.36
8.2.130.0210.00020.28
8.2.120.0100.01419.26
8.2.110.0140.00719.39
8.2.100.0110.01120.95
8.2.90.0190.00918.75
8.2.80.0100.01319.31
8.2.70.0100.00718.41
8.2.60.0190.01018.77
8.2.50.0240.00019.02
8.2.40.0270.00318.73
8.2.30.0330.00018.70
8.2.20.0180.00618.83
8.2.10.0180.01118.82
8.2.00.0250.00618.74
8.1.330.0090.00921.83
8.1.320.0130.00816.41
8.1.310.0110.00418.29
8.1.300.0100.00016.77
8.1.290.0060.00330.84
8.1.280.0090.00925.92
8.1.270.0150.00622.05
8.1.260.0140.00321.99
8.1.250.0140.00022.12
8.1.240.0260.00018.11
8.1.230.0140.01418.59
8.1.220.0160.00618.96
8.1.210.0130.01018.55
8.1.200.0130.00818.70
8.1.190.0130.01018.40
8.1.180.0330.00318.38
8.1.170.0130.01018.60
8.1.160.0190.00618.48
8.1.150.0210.01118.73
8.1.140.0260.00618.77
8.1.130.0140.01118.73
8.1.120.0140.01018.58
8.1.110.0100.01418.39
8.1.100.0160.00619.55
8.1.90.0180.00418.32
8.1.80.0180.00719.61
8.1.70.0240.00318.65
8.1.60.0290.00718.77
8.1.50.0300.00318.71
8.1.40.0210.00718.75
8.1.30.0110.00719.07
8.1.20.0060.00920.03
8.1.10.0120.00618.64
8.1.00.0100.01018.54

preferences:
27.16 ms | 403 KiB | 5 Q