3v4l.org

run code in 300+ PHP versions simultaneously
<?php $searchTerm = "abcd"; $replaceTerm = "XXXX"; $test=array("${searchTerm}/${searchTerm}_.${searchTerm}", "xay${searchTerm}", "asdasd/${searchTerm}.mp3", "${searchTerm}.", "blahahbasd${searchTerm}"); foreach ($test as $t) echo "$t => " . preg_replace("/(". preg_quote($searchTerm) . "([^_.])|". preg_quote($searchTerm) . "$)/x", preg_quote($replaceTerm) . "\${2}", $t) . "\n";

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.0060.01216.88
8.3.50.0090.01022.15
8.3.40.0070.00718.92
8.3.30.0140.00019.27
8.3.20.0040.00420.16
8.3.10.0000.00823.71
8.3.00.0030.00620.82
8.2.180.0120.00618.63
8.2.170.0100.00722.96
8.2.160.0100.00320.35
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0040.00420.72
8.2.110.0090.00021.31
8.2.100.0110.00017.97
8.2.90.0040.00419.34
8.2.80.0000.00817.97
8.2.70.0080.00017.75
8.2.60.0040.00417.80
8.2.50.0000.00818.07
8.2.40.0030.00520.01
8.2.30.0000.00718.29
8.2.20.0030.00517.89
8.2.10.0040.00418.15
8.2.00.0040.00417.77
8.1.280.0140.00425.92
8.1.270.0040.00423.78
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0070.00321.11
8.1.230.0040.00717.42
8.1.220.0040.00417.79
8.1.210.0000.00818.77
8.1.200.0000.01017.48
8.1.190.0000.00817.23
8.1.180.0040.00418.10
8.1.170.0060.00318.62
8.1.160.0040.00422.04
8.1.150.0040.00418.84
8.1.140.0000.00717.60
8.1.130.0020.00517.90
8.1.120.0080.00017.52
8.1.110.0020.00517.59
8.1.100.0000.00817.51
8.1.90.0000.00717.49
8.1.80.0000.00717.63
8.1.70.0000.00717.57
8.1.60.0040.00417.73
8.1.50.0030.00617.67
8.1.40.0000.00817.72
8.1.30.0110.00017.64
8.1.20.0040.00417.70
8.1.10.0000.00817.55
8.1.00.0000.01017.60
8.0.300.0030.00518.77
8.0.290.0030.00516.88
8.0.280.0030.00318.38
8.0.270.0080.00017.33
8.0.260.0000.00617.25
8.0.250.0030.00317.08
8.0.240.0000.00917.09
8.0.230.0030.00517.12
8.0.220.0000.00717.05
8.0.210.0030.00517.02
8.0.200.0000.00917.16
8.0.190.0080.00017.11
8.0.180.0070.00317.05
8.0.170.0040.00417.13
8.0.160.0000.00717.17
8.0.150.0030.00317.05
8.0.140.0070.00017.01
8.0.130.0030.00313.54
8.0.120.0060.00316.98
8.0.110.0000.00717.04
8.0.100.0000.00717.10
8.0.90.0070.00017.09
8.0.80.0060.01017.08
8.0.70.0000.00716.92
8.0.60.0000.00716.99
8.0.50.0040.00416.91
8.0.30.0110.01117.37
8.0.20.0130.00717.40
8.0.10.0040.00417.20
8.0.00.0080.01117.12
7.4.330.0050.00015.00
7.4.320.0030.00316.76
7.4.300.0040.00416.73
7.4.290.0030.00316.76
7.4.280.0070.00016.79
7.4.270.0000.00716.73
7.4.260.0070.00016.60
7.4.250.0060.00316.79
7.4.240.0040.00416.74
7.4.230.0070.00316.61
7.4.220.0140.00416.72
7.4.210.0030.01016.73
7.4.200.0040.00416.79
7.4.160.0060.00916.56
7.4.150.0110.00617.40
7.4.140.0130.00617.86
7.4.130.0120.00716.74
7.4.120.0070.01016.63
7.4.110.0110.01116.69
7.4.100.0130.00616.75
7.4.90.0120.00616.83
7.4.80.0050.01919.39
7.4.70.0130.00316.73
7.4.60.0090.00916.84
7.4.50.0000.00716.39
7.4.40.0030.01316.63
7.4.30.0060.01216.53
7.4.00.0060.00915.32
7.3.330.0050.00013.41
7.3.320.0030.00313.21
7.3.310.0000.00716.41
7.3.300.0000.00716.29
7.3.290.0000.01416.65
7.3.280.0110.00616.54
7.3.270.0180.00017.40
7.3.260.0110.00716.49
7.3.250.0110.01016.55
7.3.240.0100.01016.54
7.3.230.0100.00716.82
7.3.210.0130.01016.58
7.3.200.0120.00419.39
7.3.190.0130.00316.47
7.3.180.0000.01616.67
7.3.170.0120.00916.54
7.3.160.0060.00916.71
7.3.120.0100.00815.14
7.3.110.0070.01014.91
7.3.100.0040.00814.95
7.3.90.0040.01114.88
7.3.80.0000.01314.81
7.3.70.0060.00915.05
7.3.60.0030.01014.70
7.3.50.0030.01014.77
7.3.40.0120.00015.02
7.3.30.0090.00615.04
7.3.20.0060.01016.50
7.3.10.0060.01016.49
7.3.00.0100.00717.08
7.2.330.0110.00516.88
7.2.320.0070.01716.78
7.2.310.0070.01116.73
7.2.300.0100.01316.79
7.2.290.0180.00416.79
7.2.250.0150.00615.03
7.2.240.0090.00915.22
7.2.230.0080.00415.20
7.2.220.0070.01015.00
7.2.210.0060.00915.49
7.2.200.0060.00915.33
7.2.190.0070.01014.95
7.2.180.0100.00315.24
7.2.170.0070.01015.51
7.2.80.0260.00816.32
7.2.00.0090.00919.40
7.1.330.0040.01116.13
7.1.320.0140.00016.20
7.1.310.0030.01216.21
7.1.300.0000.01116.14
7.1.290.0000.00916.24
7.1.280.0060.00615.91
7.1.270.0030.01216.09
7.1.260.0030.01016.13
7.1.200.0000.01515.61
7.1.100.0000.01318.20
7.1.70.0000.00817.42
7.1.60.0030.00919.70
7.1.50.0030.01617.18
7.1.00.0030.07722.44
7.0.200.0030.00316.40
7.0.140.0070.07321.97
7.0.60.0170.05719.94
7.0.50.0130.07317.90
7.0.40.0030.05720.00
7.0.30.0600.06320.17
7.0.20.0270.04720.14
7.0.10.0100.03720.35
7.0.00.0030.05320.05
5.6.280.0000.07721.02
5.6.210.0100.07320.47
5.6.200.0030.07318.16
5.6.190.0070.05020.41
5.6.180.4170.04020.41
5.6.170.0230.04720.71
5.6.160.0070.08720.71
5.6.150.0030.04318.21
5.6.140.0100.05018.09
5.6.130.0000.04718.16
5.6.120.0030.07021.01
5.6.110.0100.06321.11
5.6.100.0100.07721.07
5.6.90.0000.04321.00
5.6.80.0030.06320.28
5.6.70.4700.02720.52
5.5.350.0230.04720.39
5.5.340.0030.05718.02
5.5.330.0100.07720.15
5.5.320.4170.04020.20
5.5.310.0200.04320.26
5.5.300.0100.07317.92
5.5.290.0130.06717.91
5.5.280.0200.06720.77
5.5.270.0030.06020.97
5.5.260.0170.07720.96
5.5.250.0030.04020.61
5.5.240.0230.08020.28
5.4.450.0470.04728.28
5.4.440.0430.04028.25
5.4.430.0170.04727.24
5.4.420.0200.04026.50
5.4.410.0170.04326.15
5.4.400.0330.04026.13
5.4.390.0130.04726.13
5.4.380.0130.05318.64
5.4.370.0170.05318.44
5.4.360.0230.04718.57
5.4.350.0200.04718.50
5.4.340.0100.05718.59
5.4.320.0070.03512.45
5.4.310.0020.04312.45
5.4.300.0090.04312.46
5.4.290.0040.05512.45
5.4.280.0080.05012.35
5.4.270.0080.03612.35
5.4.260.0120.04712.35
5.4.250.0120.06112.35
5.4.240.0080.05012.35
5.4.230.0060.05112.34
5.4.220.0090.05612.34
5.4.210.0110.03712.34
5.4.200.0100.06412.34
5.4.190.0090.04412.34
5.4.180.0070.04512.34
5.4.170.0100.05012.35
5.4.160.0090.04412.34
5.4.150.0090.04112.34
5.4.140.0090.04412.03
5.4.130.0060.05012.01
5.4.120.0050.04411.97
5.4.110.0070.03811.96
5.4.100.0100.03111.97
5.4.90.0080.04111.97
5.4.80.0070.03811.96
5.4.70.0080.04111.97
5.4.60.0080.03611.96
5.4.50.0100.04911.96
5.4.40.0100.04511.95
5.4.30.0080.04911.95
5.4.20.0100.04611.95
5.4.10.0070.03611.95
5.4.00.0110.04211.44
5.3.290.0090.03812.80
5.3.280.0130.05412.71
5.3.270.0140.05312.72
5.3.260.0110.04612.72
5.3.250.0160.05612.71
5.3.240.0090.05712.71
5.3.230.0070.05012.71
5.3.220.0040.05412.68
5.3.210.0070.05112.68
5.3.200.0070.05312.68
5.3.190.0110.05112.68
5.3.180.0040.05912.68
5.3.170.0060.05912.67
5.3.160.0100.05512.67
5.3.150.0050.06112.68
5.3.140.0080.05712.66
5.3.130.0080.05612.66
5.3.120.0080.05212.66
5.3.110.0080.05412.65
5.3.100.0050.05312.12
5.3.90.0080.04912.09
5.3.80.0050.04512.08
5.3.70.0070.04312.07
5.3.60.0130.04412.06
5.3.50.0090.03712.00
5.3.40.0120.04912.00
5.3.30.0090.05411.95
5.3.20.0100.05611.73
5.3.10.0100.05111.70
5.3.00.0100.04611.69
5.2.170.0070.0399.20
5.2.160.0060.0429.19
5.2.150.0060.0409.20
5.2.140.0130.0489.19
5.2.130.0160.0389.15
5.2.120.0100.0439.15
5.2.110.0050.0419.16
5.2.100.0090.0359.15
5.2.90.0080.0389.15
5.2.80.0070.0419.15
5.2.70.0060.0449.15
5.2.60.0090.0369.10
5.2.50.0060.0429.07
5.2.40.0050.0339.05
5.2.30.0050.0319.03
5.2.20.0050.0309.02
5.2.10.0050.0318.92
5.2.00.0050.0338.79
5.1.60.0060.0238.07
5.1.50.0090.0258.07
5.1.40.0090.0458.04
5.1.30.0080.0388.39
5.1.20.0070.0408.42
5.1.10.0060.0398.14
5.1.00.0080.0338.14
5.0.50.0040.0306.63
5.0.40.0050.0266.49
5.0.30.0030.0406.30
5.0.20.0060.0306.27
5.0.10.0100.0296.25
5.0.00.0120.0386.24
4.4.90.0060.0124.78
4.4.80.0030.0214.75
4.4.70.0050.0214.75
4.4.60.0020.0244.75
4.4.50.0050.0214.77
4.4.40.0070.0254.71
4.4.30.0020.0194.76
4.4.20.0060.0184.84
4.4.10.0030.0184.85
4.4.00.0050.0304.76
4.3.110.0060.0194.67
4.3.100.0050.0184.66
4.3.90.0040.0214.64
4.3.80.0050.0294.59
4.3.70.0050.0184.63
4.3.60.0020.0224.63
4.3.50.0040.0224.63
4.3.40.0060.0314.54
4.3.30.0040.0203.30
4.3.20.0030.0203.28
4.3.10.0030.0203.23
4.3.00.0030.02028.29

preferences:
38.05 ms | 401 KiB | 5 Q