3v4l.org

run code in 300+ PHP versions simultaneously
<?php $colours = array("Red", "Blue", "Green"); $string = "There are three Red and Green walls."; echo preg_replace("/" . implode("|", array_map(function($i) {return preg_quote($i, "/");}, $colours)) . "/", '%1%$0%2%', $string); echo "\n" . preg_replace("/\b(?:" . implode('|', $colours) . ")\b/", '%1%$0%2%', $string); $colours = array("Red", "Blue", "Green", "Blue jeans"); $string = "There are three Red and Green walls and Blue jeans."; rsort($colours, SORT_FLAG_CASE | SORT_STRING); echo "\n" . preg_replace("/" . implode("|", array_map(function($i) {return preg_quote($i, "/");}, $colours)) . "/", '%1%$0%2%',$string);

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.10.0100.00916.72
8.5.00.0100.01120.05
8.4.150.0020.00014.05
8.4.140.0110.01017.51
8.4.130.0090.01117.95
8.4.120.0100.01020.91
8.4.110.0150.00522.18
8.4.100.0120.01018.84
8.4.90.0100.01120.48
8.4.80.0080.00918.90
8.4.70.0100.00818.92
8.4.60.0130.01018.82
8.4.50.0130.00818.51
8.4.40.0130.00619.61
8.4.30.0130.00620.59
8.4.20.0100.01018.88
8.4.10.0090.00020.54
8.3.280.0170.00518.57
8.3.270.0110.01016.80
8.3.260.0050.00316.66
8.3.250.0130.00518.78
8.3.240.0130.00616.95
8.3.230.0110.00916.85
8.3.220.0130.00519.11
8.3.210.0070.01116.59
8.3.200.0090.00316.79
8.3.190.0120.00816.84
8.3.180.0130.00818.60
8.3.170.0110.00717.30
8.3.160.0080.00818.64
8.3.150.0150.00318.93
8.3.140.0100.01018.52
8.3.130.0030.00618.42
8.3.120.0090.00619.13
8.3.110.0040.00416.94
8.3.100.0080.00616.77
8.3.90.0100.00026.77
8.3.80.0030.00617.00
8.3.70.0090.01218.30
8.3.60.0110.00418.55
8.3.50.0100.00716.45
8.3.40.0130.00619.00
8.3.30.0110.00418.88
8.3.20.0000.00824.18
8.3.10.0030.00524.66
8.3.00.0050.00326.16
8.2.290.0070.00620.18
8.2.280.0080.01116.66
8.2.270.0080.00619.07
8.2.260.0030.00616.63
8.2.250.0000.00818.39
8.2.240.0130.00318.34
8.2.230.0050.00320.94
8.2.220.0120.00924.06
8.2.210.0130.00626.77
8.2.200.0060.00316.88
8.2.190.0110.00416.63
8.2.180.0160.00025.92
8.2.170.0110.01119.05
8.2.160.0090.01222.96
8.2.150.0050.00325.66
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0100.00019.66
8.2.110.0100.00022.28
8.2.100.0040.00718.03
8.2.90.0050.00317.88
8.2.80.0050.00318.04
8.2.70.0000.00817.80
8.2.60.0030.00618.22
8.2.50.0040.00418.10
8.2.40.0000.00821.15
8.2.30.0040.00418.13
8.2.20.0050.00218.15
8.2.10.0000.00721.12
8.2.00.0000.00719.26
8.1.330.0110.00722.04
8.1.320.0150.00416.37
8.1.310.0100.00718.34
8.1.300.0190.00018.29
8.1.290.0110.00030.84
8.1.280.0070.00725.92
8.1.270.0080.00023.99
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0170.00320.44
8.1.230.0030.00920.88
8.1.220.0030.00717.74
8.1.210.0050.00518.77
8.1.200.0090.00017.48
8.1.190.0050.00317.35
8.1.180.0040.00418.10
8.1.170.0050.00618.49
8.1.160.0050.00318.91
8.1.150.0000.00718.92
8.1.140.0000.00818.80
8.1.130.0000.00720.22
8.1.120.0020.00517.53
8.1.110.0050.00317.54
8.1.100.0000.00717.62
8.1.90.0070.00017.64
8.1.80.0000.00817.66
8.1.70.0000.00917.64
8.1.60.0040.00417.75
8.1.50.0040.00417.70
8.1.40.0050.00517.61
8.1.30.0000.00817.77
8.1.20.0060.00317.69
8.1.10.0030.00617.61
8.1.00.0040.00417.51
8.0.300.0040.00421.92
8.0.290.0050.00316.88
8.0.280.0040.00418.40
8.0.270.0000.00718.16
8.0.260.0060.00018.38
8.0.250.0030.00617.05
8.0.240.0000.00717.16
8.0.230.0030.00317.07
8.0.220.0080.00016.93
8.0.210.0000.00817.05
8.0.200.0000.00717.17
8.0.190.0000.00717.11
8.0.180.0040.00417.04
8.0.170.0050.00517.06
8.0.160.0000.00717.03
8.0.150.0000.00716.98
8.0.140.0030.00617.01
8.0.130.0030.00313.56
8.0.120.0080.00016.93
8.0.110.0050.00217.16
8.0.100.0000.00817.04
8.0.90.0000.00816.95
8.0.80.0080.00917.04
8.0.70.0030.00517.16
8.0.60.0040.00416.85
8.0.50.0030.00516.86
8.0.30.0150.00717.09
8.0.20.0120.01216.98
8.0.10.0040.01217.21
8.0.00.0000.01617.23
7.4.330.0030.00315.55
7.4.320.0030.00316.82
7.4.300.0050.00316.84
7.4.290.0030.00316.76
7.4.280.0050.00316.86
7.4.270.0000.00716.80
7.4.260.0000.00513.42
7.4.250.0040.00416.59
7.4.240.0000.00716.71
7.4.230.0030.00316.61
7.4.220.0040.00316.81
7.4.210.0090.00616.81
7.4.200.0000.00716.64
7.4.160.0040.01116.91
7.4.150.0030.01216.67
7.4.140.0080.00616.71
7.4.130.0070.01116.89
7.4.120.0090.01216.69
7.4.110.0090.01216.83
7.4.100.0160.00416.89
7.4.90.0030.01116.77
7.4.80.0070.01016.71
7.4.70.0040.01116.79
7.4.60.0110.00416.72
7.4.50.0090.01416.53
7.4.40.0120.00316.77
7.4.30.0110.00516.78
7.4.20.0050.01116.65
7.4.10.0100.00716.77
7.4.00.0150.01116.72
7.3.330.0020.00516.28
7.3.320.0030.00313.21
7.3.310.0000.00716.35
7.3.300.0030.00316.40
7.3.290.0100.00816.42
7.3.270.0070.00716.40
7.3.260.0090.00516.34
7.3.250.0040.01616.43
7.3.240.0060.01216.37
7.3.230.0100.01016.38
7.3.220.0040.01416.40
7.3.210.0040.01116.21
7.3.200.0000.01416.43
7.3.190.0030.01216.34
7.3.180.0030.01616.38
7.3.170.0050.01016.30
7.3.160.0090.00616.33
7.3.150.0120.01216.26
7.3.140.0090.00916.30
7.3.130.0040.01216.26
7.3.120.0120.01816.27
7.3.110.0120.01616.25
7.3.100.0060.00916.24
7.3.90.0040.01316.64
7.3.80.0070.01016.33
7.3.70.0180.01116.43
7.3.60.0180.01116.50
7.3.50.0210.00916.57
7.3.40.0230.00816.50
7.3.30.0230.00516.51
7.3.20.0170.01116.45
7.3.10.0100.02016.44
7.3.00.0300.00416.42

preferences:
34 ms | 403 KiB | 5 Q