3v4l.org

run code in 300+ PHP versions simultaneously
<?php function glue($array, $allButLast = ', ', $last = ' and ') { if (empty($array)) { return ''; } $glued = implode($allButLast, $array); $pos = strrpos($glued, $allButLast); if ($pos !== false) { $glued = substr_replace($glued, $last, $pos, strlen($allButLast)); } return $glued; } $array = [ 'bar', 'food', 'foo, bar', ]; echo glue($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.5.00.0120.00919.99
8.4.150.0020.00014.05
8.4.140.0130.00717.40
8.4.130.0110.00619.56
8.4.120.0110.01024.10
8.4.110.0110.00922.38
8.4.100.0120.00918.79
8.4.90.0110.01018.91
8.4.80.0060.00220.59
8.4.70.0060.00820.73
8.4.60.0160.00418.63
8.4.50.0160.00520.50
8.4.40.0120.00917.40
8.4.30.0100.01018.88
8.4.20.0160.00319.73
8.4.10.0090.00919.47
8.3.280.0090.01218.28
8.3.270.0100.00916.34
8.3.260.0160.00616.39
8.3.250.0110.00818.77
8.3.240.0140.00417.07
8.3.230.0110.00716.68
8.3.220.0140.00418.76
8.3.210.0100.00816.66
8.3.200.0050.00416.55
8.3.190.0110.00716.95
8.3.180.0100.00918.57
8.3.170.0110.00720.44
8.3.160.0060.01217.36
8.3.150.0120.00616.83
8.3.140.0040.00416.64
8.3.130.0130.00618.36
8.3.120.0100.01018.93
8.3.110.0060.00320.94
8.3.100.0060.00324.06
8.3.90.0110.00726.77
8.3.80.0070.00318.30
8.3.70.0120.00318.17
8.3.60.0110.00716.64
8.3.50.0100.01018.49
8.3.40.0040.01819.91
8.3.30.0200.01018.92
8.3.20.0120.00621.73
8.3.10.0130.00621.59
8.3.00.0140.01418.68
8.2.290.0110.00820.53
8.2.280.0050.00518.62
8.2.270.0120.00618.71
8.2.260.0060.00318.19
8.2.250.0120.00318.21
8.2.240.0030.00719.02
8.2.230.0040.00422.58
8.2.220.0090.00037.54
8.2.210.0000.01426.77
8.2.200.0040.00816.50
8.2.190.0140.00316.58
8.2.180.0070.01016.63
8.2.170.0270.01418.92
8.2.160.0220.01520.02
8.2.150.0250.00318.92
8.2.140.0150.00420.35
8.2.130.0110.00720.51
8.2.120.0130.00919.18
8.2.110.0110.00719.13
8.2.100.0120.00619.27
8.2.90.0210.01018.66
8.2.80.0100.01319.13
8.2.70.0090.00918.59
8.2.60.0210.00418.64
8.2.50.0300.00319.14
8.2.40.0140.01418.83
8.2.30.0160.00618.57
8.2.20.0160.00718.50
8.2.10.0170.00718.70
8.2.00.0110.01118.66
8.1.330.0120.00622.24
8.1.320.0130.00816.13
8.1.310.0100.00718.29
8.1.300.0050.00318.55
8.1.290.0030.00630.84
8.1.280.0090.01225.92
8.1.270.0060.01222.02
8.1.260.0130.00321.82
8.1.250.0080.00622.13
8.1.240.0210.00718.45
8.1.230.0200.00718.56
8.1.220.0220.00018.82
8.1.210.0200.00318.38
8.1.200.0110.01418.59
8.1.190.0160.01018.57
8.1.180.0220.00418.43
8.1.170.0110.01118.72
8.1.160.0150.00818.48
8.1.150.0150.00618.61
8.1.140.0230.00018.81
8.1.130.0110.01118.73
8.1.120.0150.00718.20
8.1.110.0240.00618.55
8.1.100.0160.00319.73
8.1.90.0130.01318.55
8.1.80.0190.00619.69
8.1.70.0150.00718.23
8.1.60.0210.00718.40
8.1.50.0320.00418.42
8.1.40.0200.00318.68
8.1.30.0030.01718.99
8.1.20.0170.00719.74
8.1.10.0150.00718.69
8.1.00.0090.00618.41

preferences:
42.66 ms | 403 KiB | 5 Q