3v4l.org

run code in 300+ PHP versions simultaneously
<?php function preg_quote_replacement($str) { return addcslashes($str, '\\$'); } $text = 'Invoice: You owe me *#5* !'; $user_search = "*#5*"; $user_replace = "*$5*"; $search = preg_quote($user_search, "/"); $replace_bad1 = $user_replace; $replace_bad2 = preg_quote($user_replace); $replace_good = preg_quote_replacement($user_replace); $new_text1 = preg_replace("/$search/", $replace_bad1, $text); $new_text2 = preg_replace("/$search/", $replace_bad2, $text); $new_text3 = preg_replace("/$search/", $replace_good, $text); echo "Input: $text\nNew1: $new_text1\nNew2: $new_text2\nNew3: $new_text3\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.0140.00416.75
8.3.50.0070.00716.59
8.3.40.0090.00618.80
8.3.30.0070.00718.97
8.3.20.0000.00820.77
8.3.10.0080.00021.94
8.3.00.0070.00020.76
8.2.180.0070.01118.41
8.2.170.0110.00718.91
8.2.160.0100.00322.96
8.2.150.0000.00725.66
8.2.140.0090.00024.66
8.2.130.0070.00722.07
8.2.120.0050.00326.35
8.2.110.0030.00621.09
8.2.100.0000.01118.03
8.2.90.0060.00319.22
8.2.80.0000.00818.05
8.2.70.0030.00617.75
8.2.60.0040.00418.04
8.2.50.0040.00418.10
8.2.40.0040.00420.59
8.2.30.0040.00419.34
8.2.20.0000.00817.75
8.2.10.0000.00718.28
8.2.00.0030.00718.21
8.1.280.0130.00925.92
8.1.270.0040.00423.79
8.1.260.0000.00828.09
8.1.250.0070.00028.09
8.1.240.0030.00721.18
8.1.230.0100.00022.08
8.1.220.0030.00517.79
8.1.210.0040.00418.77
8.1.200.0030.00717.35
8.1.190.0040.00417.35
8.1.180.0040.00418.10
8.1.170.0050.00320.29
8.1.160.0040.00419.09
8.1.150.0060.00318.89
8.1.140.0000.00719.45
8.1.130.0000.00717.66
8.1.120.0030.00317.44
8.1.110.0040.00417.58
8.1.100.0040.00417.45
8.1.90.0040.00417.57
8.1.80.0000.00817.44
8.1.70.0030.00317.55
8.1.60.0000.00817.73
8.1.50.0030.00617.69
8.1.40.0000.00817.53
8.1.30.0000.00817.80
8.1.20.0040.00417.84
8.1.10.0030.00517.66
8.1.00.0050.00217.57
8.0.300.0030.00718.77
8.0.290.0040.00416.88
8.0.280.0070.00018.46
8.0.270.0080.00017.28
8.0.260.0040.00417.29
8.0.250.0030.00316.97
8.0.240.0040.00416.94
8.0.230.0000.00717.07
8.0.220.0040.00417.07
8.0.210.0030.00317.06
8.0.200.0040.00417.14
8.0.190.0000.00717.05
8.0.180.0040.00417.08
8.0.170.0000.00816.94
8.0.160.0000.00717.13
8.0.150.0030.00317.05
8.0.140.0030.00517.00
8.0.130.0030.00313.41
8.0.120.0050.00316.91
8.0.110.0040.00416.93
8.0.100.0040.00416.93
8.0.90.0040.00417.05
8.0.80.0100.01017.02
8.0.70.0000.00717.04
8.0.60.0040.00416.90
8.0.50.0040.00417.08
8.0.30.0080.00817.10
8.0.20.0150.00917.46
8.0.10.0030.00517.07
8.0.00.0110.00616.93
7.4.330.0000.00515.08
7.4.320.0060.00016.52
7.4.300.0030.00316.73
7.4.290.0070.00016.66
7.4.280.0040.00416.74
7.4.270.0000.00716.70
7.4.260.0000.00716.84
7.4.250.0040.00416.73
7.4.240.0030.00516.80
7.4.230.0070.00016.86
7.4.220.0030.01416.90
7.4.210.0080.00716.84
7.4.200.0040.00416.91
7.4.160.0130.00416.71
7.4.150.0030.01717.40
7.4.140.0120.00817.86
7.4.130.0100.00816.80
7.4.120.0080.00816.72
7.4.110.0070.01016.71
7.4.100.0030.01416.52
7.4.90.0170.00716.85
7.4.80.0090.01119.39
7.4.70.0030.01716.57
7.4.60.0120.00616.82
7.4.50.0030.01516.57
7.4.40.0080.00916.68
7.4.30.0080.00816.81
7.4.10.0070.01115.15
7.4.00.0080.00915.10
7.3.330.0050.00013.30
7.3.320.0060.00013.31
7.3.310.0000.00816.45
7.3.300.0000.00716.32
7.3.290.0070.00016.25
7.3.280.0070.00716.45
7.3.270.0120.00617.40
7.3.260.0090.01216.38
7.3.250.0120.00516.68
7.3.240.0110.00716.62
7.3.230.0080.00816.42
7.3.210.0070.01016.34
7.3.200.0030.01316.79
7.3.190.0100.00716.77
7.3.180.0210.00616.62
7.3.170.0150.00616.71
7.3.160.0030.01416.81
7.3.130.0100.01014.93
7.3.120.0080.01014.81
7.3.110.0060.01014.91
7.3.100.0090.00614.97
7.3.90.0070.00614.92
7.3.80.0030.01015.09
7.3.70.0060.00714.99
7.3.60.0080.00714.88
7.3.50.0060.00914.93
7.3.40.0050.00714.85
7.3.30.0040.00714.93
7.3.20.0090.00516.91
7.3.10.0070.00616.62
7.3.00.0050.01116.72
7.2.330.0080.01116.91
7.2.320.0030.01416.84
7.2.310.0080.00816.80
7.2.300.0100.01316.60
7.2.290.0060.01116.76
7.2.260.0110.00715.00
7.2.250.0070.00915.32
7.2.240.0070.01115.15
7.2.230.0090.00515.18
7.2.220.0050.01015.21
7.2.210.0070.00915.13
7.2.200.0110.00215.30
7.2.190.0040.00915.09
7.2.180.0050.00715.03
7.2.170.0020.01315.11
7.2.160.0030.01214.87
7.2.150.0100.00516.94
7.2.140.0050.00617.11
7.2.130.0020.01416.87
7.2.120.0060.00916.73
7.2.110.0090.00316.96
7.2.100.0050.01017.02
7.2.90.0090.00617.13
7.2.80.0040.01017.01
7.2.70.0060.01017.13
7.2.60.0040.01116.98
7.2.50.0100.00316.91
7.2.40.0070.00316.92
7.2.30.0050.00816.99
7.2.20.0070.00616.93
7.2.10.0060.00616.88
7.2.00.0060.00617.75
7.1.330.0050.01016.03
7.1.320.0020.00816.03
7.1.310.0030.00815.92
7.1.300.0070.00715.94
7.1.290.0040.00916.00
7.1.280.0080.00615.92
7.1.270.0040.01015.82
7.1.260.0060.00615.85
7.1.250.0040.01115.88
7.1.240.0030.00915.90
7.1.230.0090.00615.95
7.1.220.0040.00815.68
7.1.210.0080.00415.89
7.1.200.0050.00715.76
7.1.190.0090.00615.93
7.1.180.0060.00315.71
7.1.170.0090.00315.75
7.1.160.0120.00315.89
7.1.150.0080.00015.65
7.1.140.0060.00615.99
7.1.130.0040.00716.11
7.1.120.0040.00415.79
7.1.110.0030.01016.00
7.1.100.0100.00015.80
7.1.90.0090.00616.07
7.1.80.0140.00315.92
7.1.70.0080.00416.68
7.1.60.0040.00817.84
7.1.50.0120.00315.76
7.1.40.0030.01015.79
7.1.30.0110.00415.86
7.1.20.0000.01316.04
7.1.10.0030.00915.88
7.1.00.0090.03819.17
7.0.330.0060.00315.41
7.0.320.0030.01015.50
7.0.310.0060.00615.49
7.0.300.0030.01215.30
7.0.290.0030.01015.60
7.0.280.0040.00415.53
7.0.270.0050.00215.56
7.0.260.0000.00915.67
7.0.250.0030.00915.73
7.0.240.0040.00415.59
7.0.230.0090.00315.34
7.0.220.0040.00815.74
7.0.210.0040.00715.33
7.0.200.0180.00815.15
7.0.190.0030.01115.58
7.0.180.0000.00815.43
7.0.170.0080.00815.46
7.0.160.0030.01015.69
7.0.150.0000.01015.50
7.0.140.0030.01015.58
7.0.130.0070.00715.65
7.0.120.0060.00615.58
7.0.110.0040.00815.61
7.0.100.0100.03317.84
7.0.90.0080.04317.58
7.0.80.0180.03317.85
7.0.70.0130.03317.94
7.0.60.0080.03717.80
7.0.50.0110.03617.89
7.0.40.0100.03016.92
7.0.30.0100.03817.02
7.0.20.0100.03717.06
7.0.10.0120.03016.93
7.0.00.0140.03117.05
5.6.400.0060.00614.46
5.6.390.0040.00814.48
5.6.380.0030.00914.03
5.6.370.0040.01114.32
5.6.360.0040.01114.52
5.6.350.0070.00714.36
5.6.340.0030.00514.36
5.6.330.0040.00414.31
5.6.320.0110.00314.29
5.6.310.0070.00714.00
5.6.300.0030.01214.08
5.6.290.0040.00714.34
5.6.280.0030.01014.05
5.6.270.0100.00314.37
5.6.260.0040.01214.30
5.6.250.0040.04417.66
5.6.240.0070.04217.55
5.6.230.0100.03717.60
5.6.220.0060.03317.29
5.6.210.0120.03417.45
5.6.200.0030.05117.73
5.6.190.0110.03317.78
5.6.180.0150.03317.65
5.6.170.0070.03617.75
5.6.160.0050.03217.65
5.6.150.0100.03217.82
5.6.140.0070.03317.86
5.6.130.0100.03317.62
5.6.120.0160.02817.74
5.6.110.0140.03617.75
5.6.100.0130.02617.71
5.6.90.0150.02717.75
5.6.80.0120.03817.25
5.6.70.0100.04217.29
5.6.60.0080.03617.40
5.6.50.0120.03817.20
5.6.40.0110.02817.35
5.6.30.0080.04117.41
5.6.20.0090.03317.29
5.6.10.0120.03517.31
5.6.00.0150.02717.35

preferences:
94.98 ms | 401 KiB | 5 Q