3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string='bla bla xxx bla *xxx bla bla **xxx bla bla ***xxx bla bla ****xxx'; $search='xxx'; $char='*'; preg_replace_callback( '/(' . preg_quote($char) . '*)' . $search . '/', function($matches) { if(strlen($matches[1]) % 2 !== 0) { return $matches[1] . '*'; } }, $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.70.0070.01418.55
8.3.60.0180.00016.50
8.3.50.0140.00621.35
8.3.40.0070.00718.96
8.3.30.0040.01119.20
8.3.20.0040.00420.38
8.3.10.0030.00621.86
8.3.00.0080.00019.26
8.2.180.0140.00316.63
8.2.170.0090.00622.96
8.2.160.0110.00320.52
8.2.150.0000.00825.66
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0040.00420.88
8.2.110.0030.00621.14
8.2.100.0040.00817.88
8.2.90.0030.00519.36
8.2.80.0060.00317.97
8.2.70.0070.00317.75
8.2.60.0000.00818.16
8.2.50.0040.00818.07
8.2.40.0090.00020.26
8.2.30.0080.00018.30
8.2.20.0040.00417.80
8.2.10.0040.00418.16
8.2.00.0000.00718.18
8.1.280.0110.00725.92
8.1.270.0110.00720.37
8.1.260.0090.00026.35
8.1.250.0080.00028.09
8.1.240.0060.00321.39
8.1.230.0120.00017.82
8.1.220.0040.00417.77
8.1.210.0030.00618.77
8.1.200.0090.00017.48
8.1.190.0030.00517.48
8.1.180.0090.00018.10
8.1.170.0040.00418.68
8.1.160.0000.00721.92
8.1.150.0040.00420.75
8.1.140.0050.00217.70
8.1.130.0000.00717.75
8.1.120.0020.00517.55
8.1.110.0000.00717.58
8.1.100.0040.00417.53
8.1.90.0050.00217.64
8.1.80.0000.00817.68
8.1.70.0000.00717.64
8.1.60.0040.00417.79
8.1.50.0060.00617.68
8.1.40.0050.00317.57
8.1.30.0030.00517.89
8.1.20.0000.00817.87
8.1.10.0000.00917.81
8.1.00.0030.00617.64
8.0.300.0000.00719.21
8.0.290.0040.00417.00
8.0.280.0000.00718.39
8.0.270.0040.00417.18
8.0.260.0040.00417.28
8.0.250.0000.00817.00
8.0.240.0040.00416.99
8.0.230.0040.00417.14
8.0.220.0000.00716.97
8.0.210.0080.00016.93
8.0.200.0000.00717.12
8.0.190.0080.00017.13
8.0.180.0030.00717.02
8.0.170.0030.00516.96
8.0.160.0030.00516.96
8.0.150.0050.00217.11
8.0.140.0030.00317.06
8.0.130.0030.00313.45
8.0.120.0000.00817.01
8.0.110.0070.00017.11
8.0.100.0080.00016.97
8.0.90.0040.00416.85
8.0.80.0080.01216.95
8.0.70.0040.00416.91
8.0.60.0040.00417.09
8.0.50.0030.00617.13
8.0.30.0070.00917.38
8.0.20.0120.00717.40
8.0.10.0040.00416.96
8.0.00.0100.00917.09
7.4.330.0050.00016.71
7.4.320.0000.00616.76
7.4.300.0030.00616.72
7.4.290.0040.00416.73
7.4.280.0000.00716.73
7.4.270.0030.00316.68
7.4.260.0000.00716.82
7.4.250.0000.00716.82
7.4.240.0030.00316.82
7.4.230.0050.00316.84
7.4.220.0090.00916.76
7.4.210.0110.00516.78
7.4.200.0050.00216.86
7.4.160.0090.00616.64
7.4.150.0090.00917.40
7.4.140.0090.01117.86
7.4.130.0110.01216.77
7.4.120.0130.00416.87
7.4.110.0030.01316.57
7.4.100.0060.01216.70
7.4.90.0130.01116.56
7.4.80.0040.01319.39
7.4.70.0040.01216.68
7.4.60.0030.01316.75
7.4.50.0030.00316.52
7.4.40.0030.01316.93
7.4.30.0120.00916.86
7.4.00.0000.00815.11
7.3.330.0030.00313.53
7.3.320.0030.00313.34
7.3.310.0070.00016.59
7.3.300.0000.00716.55
7.3.290.0030.00316.52
7.3.280.0100.00716.45
7.3.270.0210.00617.40
7.3.260.0090.00916.54
7.3.250.0090.00816.51
7.3.240.0160.00716.60
7.3.230.0090.01316.59
7.3.210.0120.00916.60
7.3.200.0060.01119.39
7.3.190.0120.00916.77
7.3.180.0070.01416.73
7.3.170.0070.01116.73
7.3.160.0120.00316.71
7.2.330.0090.01216.88
7.2.320.0100.01316.64
7.2.310.0080.01216.89
7.2.300.0120.00616.83
7.2.290.0050.01416.82
7.2.00.0140.01419.58
7.1.100.0180.00918.21
7.1.70.0030.00517.41
7.1.60.0060.01919.59
7.1.50.0070.01417.17
7.1.00.0030.07322.53
7.0.200.0000.00716.61
7.0.60.0130.04319.79
7.0.50.0100.08017.87
7.0.40.0030.08320.25
7.0.30.0270.05320.26
7.0.20.0200.04020.22
7.0.10.0070.08020.11
7.0.00.0070.05020.09
5.6.280.0070.06720.82
5.6.210.0030.08320.70
5.6.200.0130.07318.18
5.6.190.0030.05720.47
5.6.180.0570.07320.41
5.6.170.0400.07320.48
5.6.160.0100.04020.59
5.6.150.0030.07018.15
5.6.140.0100.04718.29
5.6.130.0030.05018.13
5.6.120.0130.07721.02
5.6.110.0100.08020.94
5.6.100.0130.03720.89
5.6.90.0030.06020.85
5.6.80.0170.07020.37
5.5.350.0170.05020.37
5.5.340.0100.08017.96
5.5.330.0130.07020.38
5.5.320.0230.06020.37
5.5.310.0300.07320.34
5.5.300.0130.07018.01
5.5.290.0200.06717.98
5.5.280.0030.05020.98
5.5.270.0130.08020.83
5.5.260.0130.05320.89
5.5.250.0030.04020.78
5.5.240.0030.03720.23
5.4.450.0670.04019.45
5.4.440.0170.06319.61
5.4.430.0130.06019.51
5.4.420.0100.06019.43
5.4.410.0170.05019.38
5.4.400.0200.05019.19
5.4.390.0270.04719.29
5.4.380.0100.05319.10
5.4.370.0200.05018.95
5.4.360.0230.04719.14
5.4.350.0130.05319.29
5.4.340.0200.05018.89
5.4.320.0230.05018.93
5.4.310.0130.05318.88
5.4.300.0270.04319.03
5.4.290.0100.05719.26
5.4.280.0200.05318.95
5.4.270.0330.05319.18
5.4.260.0200.04719.27
5.4.250.0130.05718.96
5.4.240.0270.04719.14
5.4.230.0270.04719.05
5.4.220.0130.05319.18
5.4.210.0200.04318.91
5.4.200.0130.06017.04
5.4.190.0030.06319.16
5.4.180.0070.06719.24
5.4.170.0230.04319.18
5.4.160.0130.05319.07
5.4.150.0100.05719.15
5.4.140.0070.05716.30
5.4.130.0170.04716.46
5.4.120.0270.03316.59
5.4.110.0230.03716.55
5.4.100.0100.05316.27
5.4.90.0200.05016.25
5.4.80.0130.06016.61
5.4.70.0170.05016.38
5.4.60.0170.04716.59
5.4.50.0130.05016.22
5.4.40.0100.05316.52
5.4.30.0100.05316.44
5.4.20.0200.04316.60
5.4.10.0170.05016.39
5.4.00.0130.05015.99
5.3.290.0170.05714.85
5.3.280.0130.05314.61
5.3.270.0200.05314.71
5.3.260.0170.05714.79
5.3.250.0230.04714.73
5.3.240.0130.06014.67
5.3.230.0130.05714.68
5.3.220.0270.06314.52
5.3.210.0170.07314.65
5.3.200.0230.06014.48
5.3.190.0170.05314.79
5.3.180.0170.05014.63
5.3.170.0100.05714.47
5.3.160.0070.05714.73
5.3.150.0170.06314.58
5.3.140.0170.06014.73
5.3.130.0100.05714.65
5.3.120.0170.05014.76
5.3.110.0230.04714.75
5.3.100.0200.04314.00
5.3.90.0200.04313.98
5.3.80.0100.05714.09
5.3.70.0230.05014.20
5.3.60.0230.04714.18
5.3.50.0170.06714.13
5.3.40.0170.05014.02
5.3.30.0300.04713.83
5.3.20.0170.04713.61
5.3.10.0230.04013.63
5.3.00.0070.05713.67
5.2.170.0170.03711.03
5.2.160.0070.05011.09
5.2.150.0130.04711.15
5.2.140.0230.04711.03
5.2.130.0130.03711.11
5.2.120.0130.05011.20
5.2.110.0130.05311.02
5.2.100.0130.05711.11
5.2.90.0130.05010.96
5.2.80.0130.04011.04
5.2.70.0100.04311.04
5.2.60.0100.04311.04
5.2.50.0100.04310.87
5.2.40.0100.04011.07
5.2.30.0100.04010.80
5.2.20.0100.04010.88
5.2.10.0070.04010.80
5.2.00.0100.03710.62
5.1.60.0200.0239.97
5.1.50.0130.0439.93
5.1.40.0100.03310.05
5.1.30.0070.04010.31
5.1.20.0130.03310.45
5.1.10.0170.03010.14
5.1.00.0170.03010.11
5.0.50.0030.0308.48
5.0.40.0100.0238.33
5.0.30.0030.0438.13
5.0.20.0100.0278.20
5.0.10.0100.0278.27
5.0.00.0070.0408.07
4.4.90.0030.0235.80
4.4.80.0070.0205.79
4.4.70.0070.0205.88
4.4.60.0100.0175.80
4.4.50.0030.0305.90
4.4.40.0030.0375.86
4.4.30.0070.0275.90
4.4.20.0030.0335.90
4.4.10.0130.0235.81
4.4.00.0030.0475.82
4.3.110.0070.0235.71
4.3.100.0030.0235.79
4.3.90.0000.0275.73
4.3.80.0030.0435.68
4.3.70.0100.0235.75
4.3.60.0100.0175.79
4.3.50.0030.0235.64
4.3.40.0070.0305.71
4.3.30.0030.0234.54
4.3.20.0030.0234.51
4.3.10.0070.0204.38
4.3.00.0200.0206.86

preferences:
56.03 ms | 401 KiB | 5 Q