3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * A polyfill library with PHP 7's improved way of doing integer division * * @author Michael Cullum <m@michaelcullum.com> * @license http://www.opensource.org/licenses/mit-license.html MIT License * @copyright 2015 Michael Cullum */ namespace { if (!function_exists('intdiv')) { function intdiv($dividend, $divisor) { $dividend = (int) $dividend; $divisor = (int) $divisor; if ($divisor === 0) { throw new DivisionByZeroError('Division by zero'); } if ($divisor === -1 && $dividend == ~PHP_INT_MAX) { throw new ArithmeticError('Division of PHP_INT_MIN by -1 is not an integer'); } $dividend = ($dividend - $dividend % $divisor); return ((int) ($dividend / $divisor)); } } if (!class_exists('ArithmeticError') || !class_exists('DivisionByZeroError')) { if (!interface_exists('Throwable')) { interface Throwable { public function getMessage(); public function getCode(); public function getFile(); public function getLine(); public function getTrace(); public function getTraceAsString(); public function getPrevious(); public function __toString(); } } if (!class_exists('Error')) { class Error extends \Exception implements \Throwable { public function __toString() { return $this->getMessage(); } } } if (!class_exists('ArithmeticError')) { class ArithmeticError extends \Error { public function __toString() { return $this->getMessage(); } } } if (!class_exists('DivisionByZeroError')) { class DivisionByZeroError extends \Error { public function __toString() { return $this->getMessage(); } } } } foreach (array('Error', 'ArithmeticError', 'DivisionByZeroError') as $class) { if (!$class instanceof \Exception || !$class instanceof \Throwable) { throw new \RuntimeException('A class named \''.$class.'\' is already defined that cannot be thrown.'); } } }

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.70.0080.00816.50
8.3.60.0110.00416.75
8.3.50.0080.00821.16
8.3.40.0060.00918.80
8.3.30.0060.01518.70
8.3.20.0070.00020.21
8.3.10.0080.00023.71
8.3.00.0000.00818.04
8.2.190.0120.00318.54
8.2.180.0040.01116.75
8.2.170.0030.01522.96
8.2.160.0030.01019.20
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0070.00026.16
8.2.120.0060.00317.50
8.2.110.0060.00319.39
8.2.100.0070.00717.63
8.2.90.0060.00319.05
8.2.80.0060.00317.97
8.2.70.0040.00417.75
8.2.60.0070.00317.78
8.2.50.0060.00318.07
8.2.40.0050.00319.38
8.2.30.0000.00820.68
8.2.20.0090.00017.87
8.2.10.0070.00018.05
8.2.00.0050.00318.15
8.1.280.0030.01425.92
8.1.270.0070.00023.76
8.1.260.0000.00726.35
8.1.250.0000.00828.09
8.1.240.0060.00323.80
8.1.230.0070.00717.42
8.1.220.0050.00317.74
8.1.210.0040.00418.77
8.1.200.0030.00617.36
8.1.190.0030.00617.23
8.1.180.0030.00618.10
8.1.170.0040.00418.45
8.1.160.0000.00821.93
8.1.150.0040.00418.77
8.1.140.0000.00821.29
8.1.130.0000.00717.70
8.1.120.0040.00417.26
8.1.110.0050.00217.36
8.1.100.0000.00717.24
8.1.90.0000.00717.41
8.1.80.0040.00417.41
8.1.70.0000.00717.36
8.1.60.0070.00017.51
8.1.50.0060.00317.34
8.1.40.0000.00817.38
8.1.30.0000.00817.61
8.1.20.0030.00517.60
8.1.10.0100.00017.45
8.1.00.0050.00217.34
8.0.300.0030.00518.77
8.0.290.0050.00216.88
8.0.280.0000.00718.54
8.0.270.0000.00917.15
8.0.260.0000.00717.14
8.0.250.0070.00017.08
8.0.240.0050.00217.05
8.0.230.0070.00017.05
8.0.220.0070.00016.92
8.0.210.0000.00716.87
8.0.200.0000.00717.00
8.0.190.0030.00517.01
8.0.180.0070.00317.00
8.0.170.0000.00816.90
8.0.160.0000.00717.05
8.0.150.0000.00816.80
8.0.140.0030.00316.88
8.0.130.0000.00613.43
8.0.120.0000.00816.84
8.0.110.0000.00716.90
8.0.100.0070.00016.94
8.0.90.0070.00016.87
8.0.80.0130.00716.94
8.0.70.0040.00417.04
8.0.60.0000.00717.03
8.0.50.0000.00716.99
8.0.30.0080.01216.98
8.0.20.0100.00917.40
8.0.10.0040.00416.96
8.0.00.0090.01016.93
7.4.330.0050.00015.08
7.4.320.0020.00516.52
7.4.300.0000.00616.35
7.4.290.0030.00316.44
7.4.280.0040.00416.36
7.4.270.0000.00716.51
7.4.260.0030.00316.46
7.4.250.0070.00016.41
7.4.240.0050.00316.39
7.4.230.0040.00416.61
7.4.220.0040.01316.39
7.4.210.0070.01416.57
7.4.200.0000.00716.63
7.4.160.0090.00616.59
7.4.150.0140.00517.40
7.4.140.0120.01217.86
7.4.130.0090.00816.49
7.4.120.0100.00916.71
7.4.110.0100.01216.57
7.4.100.0130.01016.48
7.4.90.0100.00616.70
7.4.80.0060.01219.39
7.4.70.0030.01316.66
7.4.60.0080.00816.63
7.4.50.0030.00316.62
7.4.40.0140.00716.30
7.4.30.0040.01316.48
7.4.00.0070.00714.98
7.3.330.0000.00513.40
7.3.320.0050.00013.34
7.3.310.0070.00016.35
7.3.300.0040.00416.47
7.3.290.0070.00916.42
7.3.280.0090.00916.49
7.3.270.0130.00417.40
7.3.260.0100.00716.62
7.3.250.0070.01116.52
7.3.240.0090.00816.53
7.3.230.0100.00616.49
7.3.210.0140.00716.51
7.3.200.0130.00316.64
7.3.190.0070.01016.64
7.3.180.0100.00716.36
7.3.170.0030.01916.46
7.3.160.0090.01116.58
7.3.10.0040.00916.60
7.3.00.0010.01116.52
7.2.330.0110.00716.79
7.2.320.0150.00416.69
7.2.310.0030.01416.39
7.2.300.0060.01116.69
7.2.290.0100.00916.55
7.2.130.0040.01116.91
7.2.120.0050.01216.73
7.2.110.0080.00516.88
7.2.100.0030.00816.69
7.2.90.0070.00616.87
7.2.80.0080.00616.75
7.2.70.0060.00616.88
7.2.60.0040.01116.84
7.2.50.0040.00616.72
7.2.40.0060.00616.70
7.2.30.0080.00616.97
7.2.20.0090.00316.80
7.2.10.0080.00516.69
7.2.00.0050.00517.72
7.1.250.0020.00815.74
7.1.200.0070.00715.83
7.1.100.0040.01218.23
7.1.70.0040.00417.06
7.1.60.0120.01219.50
7.1.50.0100.01016.70
7.1.00.0000.08022.28
7.0.200.0500.00714.58
7.0.60.0030.04020.05
7.0.50.0100.04717.98
7.0.40.0070.08020.13
7.0.30.0300.07320.16
7.0.20.0230.04020.27
7.0.10.0270.06320.09
7.0.00.0130.04020.29
5.6.280.0030.03320.80
5.6.210.0070.07720.69
5.6.200.0130.07318.14
5.6.190.0070.07020.45
5.6.180.3170.04720.58
5.6.170.0270.04320.57
5.6.160.0030.05320.46
5.6.150.0070.07718.25
5.6.140.0070.03718.24
5.6.130.0000.04318.24
5.6.120.0100.05321.00
5.6.110.0000.07721.01
5.6.100.0070.08021.07
5.6.90.0130.05721.13
5.6.80.0130.07720.42
5.5.350.0170.06020.43
5.5.340.0000.05717.95
5.5.330.0170.07320.35
5.5.320.0400.07720.30
5.5.310.0300.05720.31
5.5.300.0030.04018.01
5.5.290.0070.08017.96
5.5.280.0070.08020.81
5.5.270.0230.06720.78
5.5.260.0100.05020.79
5.5.250.0200.06720.61
5.5.240.0030.07020.18
5.4.450.0200.06019.66
5.4.440.0270.08019.58
5.4.430.0130.08019.61
5.4.420.0230.05019.53
5.4.410.0230.05019.32
5.4.400.0300.04319.13
5.4.390.0230.05019.15
5.4.380.0130.05719.22
5.4.370.0270.05319.34
5.4.360.0230.05019.25
5.4.350.0130.05719.13
5.4.340.0100.06318.84
5.4.320.0330.04019.15
5.4.310.0270.06319.28
5.4.300.0170.05319.38
5.4.290.0200.05019.05
5.4.280.0230.05019.15
5.4.270.0200.05319.27
5.4.260.0230.07319.00
5.4.250.0100.06319.15
5.4.240.0270.07019.29
5.4.230.0200.08019.14
5.4.220.0230.05019.05
5.4.210.0300.06019.36
5.4.200.0200.05019.14
5.4.190.0130.05718.86
5.4.180.0130.06019.27
5.4.170.0130.06019.24
5.4.160.0330.04019.13
5.4.150.0300.06019.13
5.4.140.0200.07316.49
5.4.130.0130.05716.52
5.4.120.0130.05316.40
5.4.110.0100.06316.30
5.4.100.0200.04716.66
5.4.90.0270.04716.48
5.4.80.0200.05016.29
5.4.70.0200.05016.23
5.4.60.0170.05316.26
5.4.50.0270.04016.39
5.4.40.0300.06016.59
5.4.30.0100.05716.24
5.4.20.0130.05316.44
5.4.10.0200.05016.55
5.4.00.0070.06015.97

preferences:
71.18 ms | 401 KiB | 5 Q