3v4l.org

run code in 300+ PHP versions simultaneously
<?php class php { /** * str_replace() from the end of a string that can also be limited e.g. replace only the last instance of '</div>' with '' * * @param string $find * @param string $replace * @param string $subject * @param int $replacement_limit | -1 to replace all references * * @return string */ public static function str_replace($find, $replace, $subject, $replacement_limit = -1) { $find_pattern = str_replace('/', '\/', $find); return preg_replace('/' . $find_pattern . '/', $replace, $subject, $replacement_limit); } /** * str_replace() from the end of a string that can also be limited e.g. replace only the last instance of '</div>' with '' * * @param string $find * @param string $replace * @param string $subject * @param int $replacement_limit | -1 to replace all references * * @return string */ public static function str_rreplace($find, $replace, $subject, $replacement_limit = -1) { return strrev( self::str_replace(strrev($find), strrev($replace), strrev($subject), $replacement_limit) ); } } $find = '$'; $replace = 'dollar'; $subject = 'This is a $ symbol. I like making $s.'; echo php::str_replace($find, $replace, $subject);

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.0120.00318.55
8.3.50.0070.01018.20
8.3.40.0150.00318.85
8.3.30.0040.01118.78
8.3.20.0000.00821.91
8.3.10.0040.00420.53
8.3.00.0040.00419.27
8.2.180.0040.01518.66
8.2.170.0190.00019.21
8.2.160.0110.00419.36
8.2.150.0080.00024.18
8.2.140.0030.00524.66
8.2.130.0030.00626.16
8.2.120.0040.00419.89
8.2.110.0040.00420.43
8.2.100.0080.00417.91
8.2.90.0080.00020.42
8.2.80.0030.00620.48
8.2.70.0040.00417.88
8.2.60.0070.00717.63
8.2.50.0050.00317.86
8.2.40.0030.00621.28
8.2.30.0000.00819.35
8.2.20.0040.00418.26
8.2.10.0000.00719.61
8.2.00.0060.00318.25
8.1.280.0120.00925.92
8.1.270.0080.00020.24
8.1.260.0040.00426.35
8.1.250.0030.00528.09
8.1.240.0060.00319.26
8.1.230.0110.00022.50
8.1.220.0000.00917.78
8.1.210.0060.00318.96
8.1.200.0080.00017.48
8.1.190.0050.00317.47
8.1.180.0040.00418.10
8.1.170.0040.00418.87
8.1.160.0030.00518.82
8.1.150.0000.00819.00
8.1.140.0040.00420.31
8.1.130.0070.00020.32
8.1.120.0040.00417.64
8.1.110.0000.00717.57
8.1.100.0040.00417.67
8.1.90.0050.00217.69
8.1.80.0030.00617.68
8.1.70.0000.00717.53
8.1.60.0000.01017.73
8.1.50.0000.00917.55
8.1.40.0000.00817.66
8.1.30.0040.00417.85
8.1.20.0030.00617.89
8.1.10.0040.00417.77
8.1.00.0000.00717.76
8.0.300.0070.00020.25
8.0.290.0040.00417.00
8.0.280.0000.00718.55
8.0.270.0000.00717.10
8.0.260.0030.00318.42
8.0.250.0030.00317.18
8.0.240.0030.00317.21
8.0.230.0030.00317.11
8.0.220.0000.00717.09
8.0.210.0000.00717.06
8.0.200.0030.00317.09
8.0.190.0040.00417.21
8.0.180.0000.00817.21
8.0.170.0060.00317.15
8.0.160.0050.00317.13
8.0.150.0040.00417.05
8.0.140.0000.00717.13
8.0.130.0030.00313.57
8.0.120.0040.00417.07
8.0.110.0000.00716.93
8.0.100.0040.00417.15
8.0.90.0000.00716.96
8.0.80.0060.00817.12
8.0.70.0000.00717.20
8.0.60.0000.00816.89
8.0.50.0000.00816.92
8.0.30.0060.01217.35
8.0.20.0130.00417.61
8.0.10.0030.00317.09
8.0.00.0180.00617.09
7.4.330.0050.00015.55
7.4.320.0030.00316.66
7.4.300.0000.00716.73
7.4.290.0000.00716.75
7.4.280.0040.00416.70
7.4.270.0000.00716.67
7.4.260.0020.00516.73
7.4.250.0040.00416.74
7.4.240.0030.00316.78
7.4.230.0070.00016.67
7.4.220.0000.00816.73
7.4.210.0070.00716.83
7.4.200.0000.00716.81
7.4.160.0080.00916.81
7.4.140.0110.01217.86
7.4.130.0070.01116.73
7.4.120.0040.01416.71
7.4.110.0140.00416.88
7.4.100.0180.00716.45
7.4.90.0000.01716.64
7.4.80.0100.01019.39
7.4.70.0140.00316.89
7.4.60.0130.00816.77
7.4.50.0060.01016.69
7.4.40.0030.01316.80
7.4.00.0070.01015.32
7.3.330.0000.00613.48
7.3.320.0000.00613.40
7.3.310.0020.00516.60
7.3.300.0070.00016.51
7.3.290.0030.00516.55
7.3.280.0060.01016.53
7.3.260.0130.00816.67
7.3.240.0130.00516.64
7.3.230.0160.00316.73
7.3.210.0110.00516.50
7.3.200.0030.01316.69
7.3.190.0070.01416.83
7.3.180.0070.01616.82
7.3.170.0070.01416.69
7.3.160.0000.01716.48
7.3.20.0530.00714.63
7.3.10.0490.00315.07
7.3.00.1350.00714.97
7.2.330.0180.00616.86
7.2.320.0090.01216.87
7.2.310.0070.01016.95
7.2.300.0030.01416.92
7.2.290.0130.00316.82
7.2.150.0520.00315.07
7.2.140.0380.01015.27
7.2.130.0430.00715.17
7.2.120.0380.01015.30
7.2.110.0580.00715.39
7.2.100.0440.01015.20
7.2.90.0380.00615.07
7.2.80.0390.00615.13
7.2.70.0380.00915.18
7.2.60.0690.00715.38
7.2.50.0490.01315.25
7.2.40.0600.00615.11
7.2.30.0540.01315.01
7.2.20.0530.00315.32
7.2.10.0550.01215.19
7.2.00.0530.01015.20
7.1.250.0390.01014.24

preferences:
61.45 ms | 401 KiB | 5 Q