3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MLTemplate { protected function escape($string) { return htmlspecialchars($string, ENT_COMPAT, 'UTF-8', true); } public function substr($string, $start, $length = null) { return mb_substr($string, $start, $length, 'UTF-8'); } public function esc_substr($string, $start, $length = null) { $string = $this->escape($string); $string = $this->substr($string, $start, $length); // Make sure we haven't destroyed an html entity of the end of the string. $eos = substr($string, -10); $m = array(); if (preg_match('/&[#a-zA-Z0-9]+$/', $eos, $m)) { $len = strlen($m[0]); $string = $this->substr($string, 0, -$len); } return $string; } } header('Content-Type: text/plain; charset="utf-8"'); $mlt = new MLTemplate(); var_dump($mlt->esc_substr('uasdasdadot"Ellie"', 0, 27));

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.0150.00016.50
8.3.50.0120.00523.00
8.3.40.0150.00319.04
8.3.30.0030.01019.04
8.3.20.0000.00720.16
8.3.10.0050.00323.60
8.3.00.0080.00019.50
8.2.180.0060.00918.67
8.2.170.0100.00722.96
8.2.160.0090.00620.60
8.2.150.0050.00324.18
8.2.140.0070.00024.66
8.2.130.0050.00326.16
8.2.120.0020.00520.90
8.2.110.0050.00520.43
8.2.100.0040.00818.05
8.2.90.0080.00019.28
8.2.80.0000.00817.97
8.2.70.0100.00317.38
8.2.60.0000.00818.04
8.2.50.0000.00818.07
8.2.40.0080.00018.28
8.2.30.0050.00318.25
8.2.20.0000.00817.88
8.2.10.0040.00418.19
8.2.00.0000.00717.93
8.1.280.0110.01125.92
8.1.270.0040.00423.87
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0070.00322.18
8.1.230.0110.00019.16
8.1.220.0000.00917.74
8.1.210.0040.00418.77
8.1.200.0000.01017.60
8.1.190.0040.00417.48
8.1.180.0000.00818.10
8.1.170.0000.00818.64
8.1.160.0040.00422.03
8.1.150.0070.00019.00
8.1.140.0070.00017.57
8.1.130.0030.00317.84
8.1.120.0060.00317.54
8.1.110.0030.00517.48
8.1.100.0040.00317.48
8.1.90.0020.00517.63
8.1.80.0070.00017.50
8.1.70.0030.00317.56
8.1.60.0060.00317.82
8.1.50.0050.00317.66
8.1.40.0000.00817.73
8.1.30.0050.00317.70
8.1.20.0050.00317.88
8.1.10.0000.00817.72
8.1.00.0050.00217.77
8.0.300.0070.00018.77
8.0.290.0000.00717.00
8.0.280.0000.00718.59
8.0.270.0030.00317.30
8.0.260.0030.00317.26
8.0.250.0000.00717.18
8.0.240.0030.00317.25
8.0.230.0040.00417.02
8.0.220.0070.00017.08
8.0.210.0000.00817.14
8.0.200.0030.00317.14
8.0.190.0000.00717.15
8.0.180.0040.00417.14
8.0.170.0000.00817.06
8.0.160.0040.00417.08
8.0.150.0000.00817.04
8.0.140.0040.00416.98
8.0.130.0100.00013.54
8.0.120.0030.00517.08
8.0.110.0040.00417.11
8.0.100.0050.00217.12
8.0.90.0050.00317.12
8.0.80.0060.00917.07
8.0.70.0000.00717.04
8.0.60.0040.00417.00
8.0.50.0040.00417.15
8.0.30.0090.00917.22
8.0.20.0150.01017.40
8.0.10.0040.00417.00
8.0.00.0100.00817.03
7.4.330.0050.00015.04
7.4.320.0030.00316.55
7.4.300.0040.00416.86
7.4.290.0040.00416.90
7.4.280.0000.00816.88
7.4.270.0000.00716.83
7.4.260.0030.00316.73
7.4.250.0000.00816.81
7.4.240.0030.00516.81
7.4.230.0030.00316.88
7.4.220.0150.00416.89
7.4.210.0070.01416.94
7.4.200.0030.00316.57
7.4.160.0210.01516.77
7.4.150.0070.01017.40
7.4.140.0060.01217.86
7.4.130.0120.00616.79
7.4.120.0160.00516.65
7.4.110.0120.01216.85
7.4.100.0060.01317.00
7.4.90.0080.00817.00
7.4.80.0100.01319.39
7.4.70.0140.00316.73
7.4.60.0080.00816.63
7.4.50.0000.00916.76
7.4.40.0060.01616.63
7.4.30.0120.00416.73
7.4.10.0110.00315.31
7.4.00.0050.01315.27
7.3.330.0020.00513.51
7.3.320.0030.00313.35
7.3.310.0040.00416.40
7.3.300.0060.00016.51
7.3.290.0060.00816.51
7.3.280.0080.00716.51
7.3.270.0210.00317.40
7.3.260.0190.00016.96
7.3.250.0070.01016.72
7.3.240.0170.00016.59
7.3.230.0130.00616.58
7.3.210.0090.00916.81
7.3.200.0100.00719.39
7.3.190.0120.00316.76
7.3.180.0060.01016.77
7.3.170.0060.00916.57
7.3.160.0130.00416.88
7.3.130.0030.00915.16
7.3.120.0120.00614.70
7.3.110.0110.00715.04
7.3.100.0170.00015.13
7.3.90.0160.00015.02
7.3.80.0000.01814.79
7.3.70.0060.00814.84
7.3.60.0090.00415.03
7.3.50.0030.01014.86
7.3.40.0090.00614.92
7.3.30.0040.00814.69
7.3.20.0070.01017.05
7.3.10.0080.00416.72
7.3.00.0030.00616.93
7.2.330.0150.00316.76
7.2.320.0090.00916.83
7.2.310.0100.00616.77
7.2.300.0030.01316.95
7.2.290.0120.00616.82
7.2.260.0030.01715.12
7.2.250.0040.00714.90
7.2.240.0100.00615.36
7.2.230.0120.00315.17
7.2.220.0100.01015.38
7.2.210.0000.00915.26
7.2.200.0000.01415.29
7.2.190.0000.01414.94
7.2.180.0030.00715.12
7.2.170.0090.00615.11
7.2.160.0070.01015.00
7.2.150.0090.00316.91
7.2.140.0000.01417.00
7.2.130.0060.00617.14
7.2.120.0000.01917.20
7.2.110.0040.01116.99
7.2.100.0090.00617.21
7.2.90.0040.01517.11
7.2.80.0100.00717.08
7.2.70.0070.01017.16
7.2.60.0040.01117.21
7.2.50.0070.00317.11
7.2.40.0060.00317.16
7.2.30.0040.00717.09
7.2.20.0150.00017.09
7.2.10.0060.00917.15
7.2.00.0030.01318.41
7.1.330.0070.01015.94
7.1.320.0100.01015.79
7.1.310.0070.00715.95
7.1.300.0070.00415.68
7.1.290.0030.00916.06
7.1.280.0030.01016.00
7.1.270.0070.00715.95
7.1.260.0000.01515.80
7.1.250.0030.01015.79
7.1.240.0110.00415.94
7.1.230.0040.00715.72
7.1.220.0000.01215.86
7.1.210.0060.00916.00
7.1.200.0040.01116.01
7.1.190.0060.00616.00
7.1.180.0100.00615.91
7.1.170.0040.01115.90
7.1.160.0030.01015.90
7.1.150.0040.00715.62
7.1.140.0090.00616.11
7.1.130.0060.00915.89
7.1.120.0100.00615.77
7.1.110.0030.00615.77
7.1.100.0040.00817.37
7.1.90.0040.00715.67
7.1.80.0000.01615.92
7.1.70.0030.00916.58
7.1.60.0050.00716.71
7.1.50.0070.01016.63
7.1.40.0000.01015.88
7.1.30.0090.00616.00
7.1.20.0080.00416.02
7.1.10.0000.01715.98
7.1.00.0040.04019.21
7.0.330.0040.00815.55
7.0.320.0080.00015.76
7.0.310.0060.00615.58
7.0.300.0040.01115.58
7.0.290.0060.00915.62
7.0.280.0080.00315.46
7.0.270.0130.00315.35
7.0.260.0030.00715.55
7.0.250.0000.01315.45
7.0.240.0000.00915.50
7.0.230.0040.00815.75
7.0.220.0090.00315.75
7.0.210.0070.00315.48
7.0.200.0080.00516.22
7.0.190.0040.00815.70
7.0.180.0060.00615.78
7.0.170.0000.01315.60
7.0.160.0000.01515.49
7.0.150.0120.00015.37
7.0.140.0020.04118.72
7.0.130.0080.00315.72
7.0.120.0060.00615.41
7.0.110.0110.00015.81
7.0.100.0060.00915.57
7.0.90.0030.00615.56
7.0.80.0060.00915.36
7.0.70.0040.01115.59
7.0.60.0140.03217.82
7.0.50.0050.04516.87
7.0.40.0050.02716.75
7.0.30.0100.03417.00
7.0.20.0180.03716.93
7.0.10.0040.05216.89
7.0.00.0080.04316.91
5.6.400.0030.01014.50
5.6.390.0070.00714.34
5.6.380.0070.00714.43
5.6.370.0070.00714.74
5.6.360.0120.00314.37
5.6.350.0070.00714.36
5.6.340.0080.00414.13
5.6.330.0110.00814.54
5.6.320.0000.01214.69
5.6.310.0000.01114.38
5.6.300.0030.01014.42
5.6.290.0030.00614.63
5.6.280.0020.04317.85
5.6.270.0000.01814.59
5.6.260.0100.00314.59
5.6.250.0030.00614.52
5.6.240.0030.01014.35
5.6.230.0100.00614.57
5.6.220.0060.00314.48
5.6.210.0070.04317.45
5.6.200.0080.02516.25
5.6.190.0070.02517.50
5.6.180.1770.02317.43
5.6.170.0220.02317.59
5.6.160.0000.05117.49
5.6.150.0070.02516.25
5.6.140.0080.03816.53
5.6.130.0050.02316.23
5.6.120.0050.04717.80
5.6.110.0030.03817.79
5.6.100.0050.05217.62
5.6.90.0070.04017.72
5.6.80.0170.03017.46
5.6.70.2170.02517.54
5.6.60.0070.00714.55
5.6.50.0080.00014.22
5.6.40.0030.01214.25
5.6.30.0120.00314.15
5.6.20.0120.00014.23
5.6.10.0000.01514.66
5.6.00.0030.01214.09
5.5.380.0050.01014.60
5.5.370.0040.01114.59
5.5.360.0080.00514.29
5.5.350.0160.03617.35
5.5.340.0040.02915.99
5.5.330.0080.02617.39
5.5.320.0190.02417.43
5.5.310.0220.02317.45
5.5.300.0090.02315.97
5.5.290.0030.02516.32
5.5.280.0100.02217.70
5.5.270.0020.03217.74
5.5.260.0160.03517.49
5.5.250.0110.04217.46
5.5.240.0090.04217.29
5.5.230.0130.00314.09
5.5.220.0070.00714.30
5.5.210.0000.01314.35
5.5.200.0070.01014.21
5.5.190.0110.00714.39
5.5.180.0000.01114.39
5.5.170.0100.00714.32
5.5.160.0030.01314.41
5.5.150.0050.00814.13
5.5.140.0060.00914.09
5.5.130.0060.00914.46
5.5.120.0070.01014.02
5.5.110.0000.01614.05
5.5.100.0060.01014.27
5.5.90.0060.00614.32
5.5.80.0070.01014.26
5.5.70.0060.01114.28
5.5.60.0000.01114.44
5.5.50.0080.01214.12
5.5.40.0030.00914.07
5.5.30.0110.00414.27
5.5.20.0100.00514.12
5.5.10.0110.00614.36
5.5.00.0060.01014.14
5.4.450.0130.02915.31
5.4.440.0130.02315.34
5.4.430.0200.02515.33
5.4.420.0130.02315.26
5.4.410.0190.02415.15
5.4.400.0220.02515.12
5.4.390.0210.02115.15
5.4.380.0220.02714.92
5.4.370.0300.02914.61
5.4.360.0190.03014.88
5.4.350.0250.03814.90
5.4.340.0270.02914.73
5.4.330.0070.00711.16
5.4.320.0090.02011.75
5.4.310.0050.02311.74
5.4.300.0080.02011.75
5.4.290.0060.02111.80
5.4.280.0050.02111.76
5.4.270.0030.02311.71
5.4.260.0040.02111.82
5.4.250.0040.02311.78
5.4.240.0070.02011.82
5.4.230.0020.02511.56
5.4.220.0040.02311.76
5.4.210.0050.02111.80
5.4.200.0060.02111.71
5.4.190.0040.02311.68
5.4.180.0030.02411.72
5.4.170.0050.02211.74
5.4.160.0060.02211.78
5.4.150.0060.02111.53
5.4.140.0060.02011.62
5.4.130.0080.01811.59
5.4.120.0040.02311.41
5.4.110.0050.02411.35
5.4.100.0040.02311.70
5.4.90.0040.02811.59
5.4.80.0030.02411.61
5.4.70.0060.02011.43
5.4.60.0020.02511.63
5.4.50.0040.02211.63
5.4.40.0070.02011.53
5.4.30.0040.02211.43
5.4.20.0030.02111.56
5.4.10.0040.02211.55
5.4.00.0080.02011.19
5.3.290.0060.04212.80
5.3.280.0050.03812.71
5.3.270.0040.04012.72
5.3.260.0050.03912.72
5.3.250.0050.03712.72
5.3.240.0040.03812.72
5.3.230.0060.03712.71
5.3.220.0080.03612.68
5.3.210.0070.03812.68
5.3.200.0050.03912.68
5.3.190.0050.03712.68
5.3.180.0040.03812.67
5.3.170.0060.03612.67
5.3.160.0030.03912.67
5.3.150.0070.03612.67
5.3.140.0110.03412.66
5.3.130.0060.03712.65
5.3.120.0070.03712.66
5.3.110.0010.04312.65
5.3.100.0040.03812.13
5.3.90.0070.03612.12
5.3.80.0090.03712.11
5.3.70.0090.03812.11
5.3.60.0080.03412.10
5.3.50.0050.03712.04
5.3.40.0040.03812.05
5.3.30.0040.03512.00
5.3.20.0070.03611.78
5.3.10.0070.03311.75
5.3.00.0060.03711.73
5.2.170.0020.0329.24
5.2.160.0070.0409.24
5.2.150.0050.0299.24
5.2.140.0050.0429.24
5.2.130.0020.0319.19
5.2.120.0000.0329.20
5.2.110.0090.0249.21
5.2.100.0040.0299.20
5.2.90.0050.0289.20
5.2.80.0050.0349.19
5.2.70.0050.0309.19
5.2.60.0050.0299.14
5.2.50.0050.0299.12
5.2.40.0050.0279.10
5.2.30.0060.0279.07
5.2.20.0070.0259.06
5.2.10.0040.0348.95
5.2.00.0080.0348.82
5.1.60.0030.0298.09
5.1.50.0080.0208.09
5.1.40.0060.0248.08
5.1.30.0050.0268.42
5.1.20.0050.0298.45
5.1.10.0030.0268.17
5.1.00.0050.0268.17
5.0.50.0040.0196.65
5.0.40.0030.0196.51
5.0.30.0020.0326.32
5.0.20.0050.0176.29
5.0.10.0040.0196.27
5.0.00.0020.0326.26
4.4.90.0030.0154.78
4.4.80.0030.0194.75
4.4.70.0020.0264.75
4.4.60.0020.0164.75
4.4.50.0020.0234.77
4.4.40.0020.0324.71
4.4.30.0020.0174.76
4.4.20.0020.0184.84
4.4.10.0040.0214.85
4.4.00.0030.0314.76
4.3.110.0010.0174.67
4.3.100.0020.0154.66
4.3.90.0060.0134.64
4.3.80.0050.0234.58
4.3.70.0020.0154.63
4.3.60.0030.0144.63
4.3.50.0030.0174.63
4.3.40.0020.0294.54
4.3.30.0030.0183.30
4.3.20.0020.0203.28
4.3.10.0020.0153.23
4.3.00.0070.01715.68

preferences:
47.11 ms | 401 KiB | 5 Q