3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'xxx bla *xxx bla bla **xxx bla bla ***xxx bla bla ****xxx'; $search = 'xxx'; $char = '*'; $string = preg_replace_callback( '/\b(' . preg_quote($char) . '*)(' . $search . ')\b/', function($matches) { if(strlen($matches[1]) % 2 === 0) { return $matches[1] . $char . $matches[2]; } else { return $matches[0]; } }, $string ); print $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.3.60.0090.00616.61
8.3.50.0170.00521.21
8.3.40.0120.00619.27
8.3.30.0110.00419.04
8.3.20.0000.00720.39
8.3.10.0090.00021.76
8.3.00.0110.00018.00
8.2.180.0150.00618.68
8.2.170.0060.01222.96
8.2.160.0040.01120.39
8.2.150.0040.00425.66
8.2.140.0040.01524.66
8.2.130.0000.00826.16
8.2.120.0040.00420.89
8.2.110.0070.00319.14
8.2.100.0080.00317.97
8.2.90.0000.00819.30
8.2.80.0040.00417.97
8.2.70.0060.00318.00
8.2.60.0000.00817.93
8.2.50.0070.00318.07
8.2.40.0030.00520.19
8.2.30.0090.00018.17
8.2.20.0040.00417.96
8.2.10.0050.00318.09
8.2.00.0020.00518.16
8.1.280.0070.00725.92
8.1.270.0080.00020.30
8.1.260.0070.00026.35
8.1.250.0080.00028.09
8.1.240.0040.00421.99
8.1.230.0080.00419.04
8.1.220.0000.00817.77
8.1.210.0050.00518.77
8.1.200.0030.00717.61
8.1.190.0030.00517.25
8.1.180.0060.00318.10
8.1.170.0030.00518.65
8.1.160.0050.00222.05
8.1.150.0040.00418.86
8.1.140.0000.00817.63
8.1.130.0030.00317.69
8.1.120.0040.00417.51
8.1.110.0080.00017.57
8.1.100.0000.00817.65
8.1.90.0040.00417.52
8.1.80.0000.00717.61
8.1.70.0030.00317.45
8.1.60.0030.00617.76
8.1.50.0090.00317.66
8.1.40.0040.00417.50
8.1.30.0000.00917.89
8.1.20.0040.00417.66
8.1.10.0040.00417.64
8.1.00.0040.00817.68
8.0.300.0080.00018.77
8.0.290.0040.00416.88
8.0.280.0030.00318.49
8.0.270.0050.00217.20
8.0.260.0060.00017.23
8.0.250.0000.00717.24
8.0.240.0030.00317.20
8.0.230.0000.00717.20
8.0.220.0030.00317.05
8.0.210.0020.00517.10
8.0.200.0040.00417.18
8.0.190.0000.00817.15
8.0.180.0040.00417.14
8.0.170.0000.00817.00
8.0.160.0050.00316.97
8.0.150.0080.00017.13
8.0.140.0050.00316.96
8.0.130.0000.00513.58
8.0.120.0040.00417.13
8.0.110.0080.00017.13
8.0.100.0070.00016.98
8.0.90.0030.00516.91
8.0.80.0090.01217.04
8.0.70.0040.00417.00
8.0.60.0040.00417.14
8.0.50.0050.00317.15
8.0.30.0090.01017.27
8.0.20.0080.01017.40
8.0.10.0040.00417.24
8.0.00.0050.01317.03
7.4.330.0000.00516.77
7.4.320.0000.00716.71
7.4.300.0030.00616.81
7.4.290.0000.00716.65
7.4.280.0040.00416.83
7.4.270.0000.00816.87
7.4.260.0030.00316.73
7.4.250.0040.00416.70
7.4.240.0000.00716.78
7.4.230.0050.00216.63
7.4.220.0060.01316.77
7.4.210.0050.01116.83
7.4.200.0030.00316.54
7.4.160.0190.00416.88
7.4.150.0060.01217.40
7.4.140.0060.01117.86
7.4.130.0110.00716.59
7.4.120.0030.01516.76
7.4.110.0110.00816.72
7.4.100.0170.01016.84
7.4.90.0100.01316.64
7.4.80.0160.00019.39
7.4.70.0000.02016.68
7.4.60.0070.01016.64
7.4.50.0060.00016.55
7.4.40.0000.01616.78
7.4.30.0080.00816.71
7.4.00.0040.01115.26
7.3.330.0060.00013.40
7.3.320.0030.00313.40
7.3.310.0030.00316.55
7.3.300.0000.00716.66
7.3.290.0070.00016.52
7.3.280.0100.00416.52
7.3.270.0140.00317.40
7.3.260.0100.00616.84
7.3.240.0110.00616.93
7.3.230.0090.01316.62
7.3.210.0170.00316.87
7.3.200.0040.01519.39
7.3.190.0140.00316.46
7.3.180.0070.01016.63
7.3.170.0090.01516.67
7.3.160.0130.00316.61
7.2.330.0050.01416.88
7.2.320.0100.01316.97
7.2.310.0170.00016.98
7.2.300.0150.00316.91
7.2.290.0090.01216.84
7.2.00.0070.00719.16
7.1.100.0970.00316.72
7.1.70.0030.00617.45
7.1.60.0080.01219.59
7.1.50.0110.01417.05
7.1.00.0070.07322.46
7.0.200.0000.00716.96
7.0.60.0000.04720.03
7.0.50.0070.07017.92
7.0.40.0070.06020.17
7.0.30.0300.06020.08
7.0.20.0300.08020.20
7.0.10.0370.07020.34
7.0.00.0000.04720.10
5.6.280.0030.07020.81
5.6.210.0070.04320.59
5.6.200.0100.08318.23
5.6.190.0130.07720.48
5.6.180.3730.04020.39
5.6.170.0200.08020.47
5.6.160.0100.08020.61
5.6.150.0130.08018.27
5.6.140.0170.09718.28
5.6.130.0100.06018.21
5.6.120.0100.07720.99
5.6.110.0100.08021.14
5.6.100.0130.06720.98
5.6.90.0070.08321.08
5.6.80.0130.07720.41
5.6.70.3730.03320.44
5.5.350.0200.07320.28
5.5.340.0070.08018.00
5.5.330.0000.05020.57
5.5.320.0370.08020.51
5.5.310.0270.05320.38
5.5.300.0070.08317.92
5.5.290.0070.07717.98
5.5.280.0030.07020.88
5.5.270.0170.05320.79
5.5.260.0100.08020.84
5.5.250.0070.07320.71
5.5.240.0000.08020.36
5.4.450.0200.04019.48
5.4.440.0530.07019.38
5.4.430.0800.08319.45
5.4.420.0830.07019.52
5.4.410.0770.07719.24
5.4.400.1000.06019.14
5.4.390.0830.06319.26
5.4.380.0570.08719.21
5.4.370.0800.05719.25
5.4.360.0930.07318.84
5.4.350.0730.07019.18
5.4.340.0630.07718.89
5.4.320.1030.06318.91
5.4.310.0930.06318.95
5.4.300.0830.05719.18
5.4.290.0730.06319.13
5.4.280.0730.06019.15
5.4.270.0870.06719.20
5.4.260.0900.07719.13
5.4.250.0770.08019.29
5.4.240.0900.07319.20
5.4.230.0930.06719.02
5.4.220.0800.08019.13
5.4.210.0800.05319.05
5.4.200.0530.05717.06
5.4.190.0630.05318.93
5.4.180.0630.05718.81
5.4.170.0900.04318.97
5.4.160.0430.05719.06
5.4.150.0530.06719.05
5.4.140.0700.07316.42
5.4.130.0730.05716.63
5.4.120.0600.06016.50
5.4.110.1000.07016.58
5.4.100.0870.05016.62
5.4.90.0730.05316.63
5.4.80.0830.05716.39
5.4.70.0830.05016.39
5.4.60.0800.04016.22
5.4.50.0800.05716.32
5.4.40.0800.04016.55
5.4.30.0730.05716.31
5.4.20.0700.05716.50
5.4.10.0600.05716.23
5.4.00.0730.05716.08
5.3.290.0800.06714.78
5.3.280.0770.04714.56
5.3.270.0700.05314.72
5.3.260.0700.07714.83
5.3.250.0330.04714.56
5.3.240.0530.05314.79
5.3.230.0600.06314.82
5.3.220.0670.06314.78
5.3.210.0700.06014.54
5.3.200.0370.06014.52
5.3.190.0330.05714.54
5.3.180.0670.05014.70
5.3.170.0600.05014.67
5.3.160.0530.06014.77
5.3.150.0100.06714.54
5.3.140.0600.05014.73
5.3.130.0530.05714.54
5.3.120.0570.05714.53
5.3.110.0570.05314.66
5.3.100.0670.05013.99
5.3.90.0670.05714.24
5.3.80.0770.06314.07
5.3.70.1100.05014.21
5.3.60.0570.06314.07
5.3.50.0670.06714.16
5.3.40.0830.06314.12
5.3.30.0670.05313.94
5.3.20.0600.05313.91
5.3.10.0870.04713.88
5.3.00.0700.05713.85
5.2.170.0700.04011.08
5.2.160.0430.04011.06
5.2.150.0370.05011.06
5.2.140.0570.03310.96
5.2.130.0430.04711.11
5.2.120.0300.04010.93
5.2.110.0430.04310.96
5.2.100.0500.04010.96
5.2.90.0630.04311.18
5.2.80.0500.03711.04
5.2.70.0430.04711.19
5.2.60.0630.05010.85
5.2.50.0470.05711.02
5.2.40.0370.03711.09
5.2.30.0530.03710.97
5.2.20.0430.04011.05
5.2.10.0400.04310.91
5.2.00.0300.05310.66
5.1.60.0200.0439.84
5.1.50.0430.03310.00
5.1.40.0500.0339.89
5.1.30.0400.04010.38
5.1.20.0470.05010.24
5.1.10.0430.0439.96
5.1.00.0470.0309.99
5.0.50.0130.0338.39
5.0.40.0230.0278.45
5.0.30.0270.0438.16
5.0.20.0100.0278.20
5.0.10.0230.0308.17
5.0.00.0170.0438.24
4.4.90.0230.0275.77
4.4.80.0170.0275.80
4.4.70.0170.0275.78
4.4.60.0200.0275.79
4.4.50.0230.0205.78
4.4.40.0170.0375.79
4.4.30.0100.0235.73
4.4.20.0230.0235.79
4.4.10.0370.0205.87
4.4.00.0200.0335.93
4.3.110.0130.0275.71
4.3.100.0170.0235.79
4.3.90.0270.0235.80
4.3.80.0230.0335.78
4.3.70.0270.0205.80
4.3.60.0200.0205.67
4.3.50.0170.0375.81
4.3.40.0530.0375.75
4.3.30.0130.0274.60
4.3.20.0100.0234.41
4.3.10.0130.0204.38
4.3.00.0000.01316.61

preferences:
34.7 ms | 401 KiB | 5 Q