3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { var $pos = 0; var $str; function Foo($str) { $this->__construct($str); } function __construct($str) { $this->str = $str; $this->current = $this->lookAhead(); } function isLineBreak() { if ("\r" !== $this->current && "\n" !== $this->current) { return false; } $char = $this->current; do { $brk = ("\n" === $char); $char = $this->lookAhead(); switch ($char) { case " ": return false; case "\n": if ($brk) { return true; } break; default: return $brk; } } while (true); } function lookAhead() { return mb_strcut($this->str, $this->pos++, 1); } } function crlf($str) { $foo = new Foo($str); return $foo->isLineBreak(); } var_dump(crlf("\r\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.0110.00718.65
8.3.50.0120.00721.27
8.3.40.0110.00418.84
8.3.30.0040.01218.71
8.3.20.0040.00418.57
8.3.10.0000.00821.10
8.3.00.0040.00421.76
8.2.180.0110.00418.66
8.2.170.0040.01122.96
8.2.160.0030.01020.44
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0070.00320.94
8.2.110.0090.00020.52
8.2.100.0120.00017.87
8.2.90.0040.00419.17
8.2.80.0030.00617.97
8.2.70.0000.00917.50
8.2.60.0000.00817.93
8.2.50.0060.00318.07
8.2.40.0040.00418.14
8.2.30.0040.00421.20
8.2.20.0050.00317.73
8.2.10.0040.00417.81
8.2.00.0070.00317.69
8.1.280.0060.01325.92
8.1.270.0080.00023.99
8.1.260.0090.00926.35
8.1.250.0050.00328.09
8.1.240.0100.00022.46
8.1.230.0080.00321.03
8.1.220.0000.00818.77
8.1.210.0080.00018.89
8.1.200.0090.00017.25
8.1.190.0030.00517.66
8.1.180.0030.00618.10
8.1.170.0080.00018.71
8.1.160.0050.00318.82
8.1.150.0050.00218.61
8.1.140.0000.00717.37
8.1.130.0000.00717.72
8.1.120.0050.00217.39
8.1.110.0000.00717.45
8.1.100.0020.00517.52
8.1.90.0000.00717.46
8.1.80.0000.00717.48
8.1.70.0070.00017.47
8.1.60.0030.00617.56
8.1.50.0000.00817.56
8.1.40.0000.00817.50
8.1.30.0050.00317.67
8.1.20.0000.00817.58
8.1.10.0020.00517.61
8.1.00.0040.00717.57
8.0.300.0000.00820.15
8.0.290.0040.00417.17
8.0.280.0000.00718.43
8.0.270.0070.00017.32
8.0.260.0000.00617.02
8.0.250.0060.00316.97
8.0.240.0080.00017.00
8.0.230.0040.00417.13
8.0.220.0030.00317.00
8.0.210.0030.00317.02
8.0.200.0000.00717.09
8.0.190.0040.00417.04
8.0.180.0000.00717.06
8.0.170.0000.00817.00
8.0.160.0050.00217.05
8.0.150.0040.00416.86
8.0.140.0000.00717.01
8.0.130.0030.00313.43
8.0.120.0040.00416.95
8.0.110.0000.00816.93
8.0.100.0030.00516.92
8.0.90.0050.00317.04
8.0.80.0060.00916.98
8.0.70.0040.00416.99
8.0.60.0040.00417.08
8.0.50.0030.00516.82
8.0.30.0060.01317.12
8.0.20.0080.01117.44
8.0.10.0060.00317.13
8.0.00.0090.01016.78
7.4.330.0000.00616.67
7.4.320.0030.00316.59
7.4.300.0060.00016.51
7.4.290.0070.00016.52
7.4.280.0100.00016.52
7.4.270.0040.00416.62
7.4.260.0000.00513.28
7.4.250.0050.00316.53
7.4.240.0030.00416.38
7.4.230.0070.00016.65
7.4.220.0100.01616.43
7.4.210.0060.01116.56
7.4.200.0040.00416.55
7.4.190.0030.00316.66
7.4.160.0030.01616.61
7.4.150.0090.01217.40
7.4.140.0100.00917.86
7.4.130.0070.01016.43
7.4.120.0090.00816.62
7.4.110.0160.00016.53
7.4.100.0070.01116.49
7.4.90.0150.00616.56
7.4.80.0070.01019.39
7.4.70.0130.00316.48
7.4.60.0130.00316.48
7.4.50.0000.00916.63
7.4.40.0070.01122.77
7.4.30.0070.01016.45
7.4.00.0040.01514.76
7.3.330.0050.00013.39
7.3.320.0070.00713.36
7.3.310.0000.00716.46
7.3.300.0040.00416.44
7.3.290.0040.01116.50
7.3.280.0080.00916.44
7.3.270.0070.01117.40
7.3.260.0100.01118.24
7.3.250.0100.00716.49
7.3.240.0070.01016.36
7.3.230.0170.00016.39
7.3.210.0080.00816.66
7.3.200.0110.00719.39
7.3.190.0110.01116.43
7.3.180.0130.00316.56
7.3.170.0060.00916.67
7.3.160.0140.00916.68
7.3.120.0070.00815.06
7.3.10.0070.00716.66
7.3.00.0060.00616.67
7.2.330.0100.01016.68
7.2.320.0130.00616.46
7.2.310.0140.00716.86
7.2.300.0060.01216.65
7.2.290.0140.00316.71
7.2.130.0000.01717.13
7.2.120.0060.00616.90
7.2.110.0000.00917.06
7.2.100.0030.01017.14
7.2.90.0090.00317.07
7.2.80.0030.00917.21
7.2.70.0030.00916.96
7.2.60.0020.01316.88
7.2.50.0030.01016.59
7.2.40.0070.00716.96
7.2.30.0080.00416.85
7.2.20.0100.00317.05
7.2.10.0030.00716.96
7.2.00.0030.01118.32
7.1.250.0040.01115.82
7.1.200.0000.01515.45
7.1.100.0030.00918.04
7.1.70.0040.00416.93
7.1.60.0130.01319.40
7.1.50.0070.01417.02
7.1.00.0030.05722.45
7.0.200.0130.00816.66
7.0.140.0100.06721.97
7.0.70.0070.07721.73
7.0.60.0100.07021.58
7.0.50.0030.09021.96
7.0.40.0100.07720.13
7.0.30.0030.07320.10
7.0.20.0000.06320.15
7.0.10.0030.08020.02
7.0.00.0030.08320.04
5.6.280.0100.06721.03
5.6.220.0070.06020.59
5.6.210.0070.08320.58
5.6.200.0130.05321.02
5.6.190.0070.05720.96
5.6.180.0030.04021.09
5.6.170.0100.03321.18
5.6.160.0070.05721.13
5.6.150.0070.07721.05
5.6.140.0030.09021.04
5.6.130.0070.08321.12
5.6.120.0070.05021.12
5.6.110.0100.05720.96
5.6.100.0030.08021.07
5.6.90.0000.07320.95
5.6.80.0030.08320.53
5.6.70.0000.06720.53
5.6.60.0100.07320.39
5.6.50.0030.04720.50
5.6.40.0000.06720.40
5.6.30.0000.06320.34
5.6.20.0070.04720.40
5.6.10.0100.07320.38
5.6.00.0000.07020.38
5.5.360.0030.06020.57
5.5.350.0100.07720.53
5.5.340.0000.08720.90
5.5.330.0130.05320.82
5.5.320.0030.04020.81
5.5.310.0030.04020.63
5.5.300.0000.06020.93
5.5.290.0130.07720.88
5.5.280.0170.06320.84
5.5.270.0030.09020.92
5.5.260.0130.07720.89
5.5.250.0030.08720.56
5.5.240.0070.04020.29
5.5.230.0070.04020.31
5.5.220.0100.06720.25
5.5.210.0070.05720.28
5.5.200.0030.07320.27
5.5.190.0000.04320.12
5.5.180.0100.03720.25
5.5.160.0070.07720.26
5.5.150.0070.07720.00
5.5.140.0000.06720.12
5.5.130.0100.05720.00
5.5.120.0100.07720.26
5.5.110.0030.05720.18
5.5.100.0000.04720.19
5.5.90.0030.06020.16
5.5.80.0070.07320.08
5.5.70.0100.07720.17
5.5.60.0100.04319.98
5.5.50.0100.05020.16
5.5.40.0000.08320.11
5.5.30.0030.05020.10
5.5.20.0030.08320.06
5.5.10.0130.05020.04
5.5.00.0070.07720.12
5.4.450.0000.06719.51
5.4.440.0070.04319.50
5.4.430.0030.06319.35
5.4.420.0030.06019.35
5.4.410.0030.08319.36
5.4.400.0070.05718.88
5.4.390.0030.07719.05
5.4.380.0100.07319.14
5.4.370.0070.07319.03
5.4.360.0100.07018.85
5.4.350.0000.07019.11
5.4.340.0000.04019.25
5.4.320.0070.05719.12
5.4.310.0030.08019.21
5.4.300.0000.08318.87
5.4.290.0030.07018.87
5.4.280.0000.08319.16
5.4.270.0170.06019.02
5.4.260.0030.08019.18
5.4.250.0130.06318.90
5.4.240.0030.04319.23
5.4.230.0000.08319.22
5.4.220.0070.07319.14
5.4.210.0030.07319.06
5.4.200.0070.07019.23
5.4.190.0030.05318.87
5.4.180.0030.08019.02
5.4.170.0070.06319.23
5.4.160.0000.08018.88
5.4.150.0030.03719.03
5.4.140.0030.03316.39
5.4.130.0000.07716.19
5.4.120.0030.06016.55
5.4.110.0200.05016.48
5.4.100.0000.07016.38
5.4.90.0030.05016.54
5.4.80.0100.06716.50
5.4.70.0030.07316.52
5.4.60.0070.06716.46
5.4.50.0030.07016.30
5.4.40.0030.07016.52
5.4.30.0100.06316.41
5.4.20.0070.03316.31
5.4.10.0070.04016.45
5.4.00.0030.06015.90
5.3.290.0170.06315.82
5.3.280.0030.05715.82
5.3.270.0070.08015.82
5.3.260.0070.03715.82
5.3.250.0030.05715.82
5.3.240.0000.03715.82
5.3.230.0070.05015.82
5.3.220.0030.05315.82
5.3.210.0000.07715.82
5.3.200.0030.06315.82
5.3.190.0000.07315.82
5.3.180.0030.07715.82
5.3.170.0030.07715.82
5.3.160.0100.05315.82
5.3.150.0070.05315.82
5.3.140.0170.07015.82
5.3.130.0100.07015.82
5.3.120.0030.06015.82
5.3.110.0100.07315.82
5.3.100.0000.08015.82
5.3.90.0030.06715.82
5.3.80.0000.06315.82
5.3.70.0070.04715.82
5.3.60.0030.06315.82
5.3.50.0000.07015.82
5.3.40.0070.07315.82
5.3.30.0000.05015.82
5.3.20.0000.03715.82
5.3.10.0000.04715.82
5.3.00.0030.06015.82
5.2.170.0070.06015.82
5.2.160.0100.05715.82
5.2.150.0030.06315.82
5.2.140.0030.03015.82
5.2.130.0000.04715.82
5.2.120.0070.05315.82
5.2.110.0030.06015.82
5.2.100.0030.04015.82
5.2.90.0000.06715.82
5.2.80.0070.05715.82
5.2.70.0070.06015.82
5.2.60.0000.06715.82
5.2.50.0100.03715.82
5.2.40.0070.06315.82
5.2.30.0030.04015.82
5.2.20.0070.05715.82
5.2.10.0030.05715.82
5.2.00.0000.04015.82
5.1.60.0030.05715.82
5.1.50.0030.04715.82
5.1.40.0030.04715.82
5.1.30.0070.05715.82
5.1.20.0030.05715.82
5.1.10.0000.04315.82
5.1.00.0000.04715.82
5.0.50.0030.04315.82
5.0.40.0030.04315.82
5.0.30.0000.06715.82
5.0.20.0030.04315.82
5.0.10.0030.04315.82
5.0.00.0030.06315.82
4.4.90.0000.03715.82
4.4.80.0030.02315.82
4.4.70.0030.02715.82
4.4.60.0030.03715.82
4.4.50.0000.03015.82
4.4.40.0000.03315.82
4.4.30.0000.02715.82
4.4.20.0000.03315.82
4.4.10.0030.03315.82
4.4.00.0000.04715.82
4.3.110.0000.04015.82
4.3.100.0000.03715.82
4.3.90.0000.03715.82
4.3.80.0000.03715.82
4.3.70.0030.03315.82
4.3.60.0000.03315.82
4.3.50.0000.03315.82
4.3.40.0000.04315.82
4.3.30.0100.02715.82
4.3.20.0000.04015.82
4.3.10.0000.03015.82
4.3.00.0000.03015.82

preferences:
47.34 ms | 401 KiB | 5 Q