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 (!class_exists('Throwable')) { class Throwable extends \Exception { public function __toString() { return $this->getMessage(); } } } if (!class_exists('Error')) { class Error extends 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) { print_r(class_implements($class)); if (!count(array_intersect(array('Exception', 'Throwable'), class_implements($class)))) { 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.60.0110.00316.50
8.3.50.0090.01216.21
8.3.40.0110.00418.71
8.3.30.0150.00618.64
8.3.20.0040.00420.29
8.3.10.0040.00423.65
8.3.00.0080.00017.80
8.2.180.0100.01016.50
8.2.170.0040.01122.96
8.2.160.0150.00320.58
8.2.150.0030.00624.18
8.2.140.0090.00624.66
8.2.130.0040.00426.16
8.2.120.0040.00717.50
8.2.110.0030.00621.12
8.2.100.0090.00317.72
8.2.90.0090.00017.48
8.2.80.0030.00617.97
8.2.70.0040.00417.63
8.2.60.0000.00917.92
8.2.50.0080.00018.07
8.2.40.0030.00519.34
8.2.30.0070.00020.55
8.2.20.0030.00517.55
8.2.10.0000.00719.73
8.2.00.0040.00418.02
8.1.280.0140.00325.92
8.1.270.0070.01324.02
8.1.260.0080.00026.35
8.1.250.0000.00728.09
8.1.240.0070.01022.38
8.1.230.0060.00620.88
8.1.220.0030.00617.74
8.1.210.0060.00318.92
8.1.200.0050.00317.35
8.1.190.0000.00817.25
8.1.180.0050.00318.10
8.1.170.0040.00418.53
8.1.160.0050.00321.95
8.1.150.0040.00418.76
8.1.140.0080.00019.54
8.1.130.0070.00017.66
8.1.120.0040.00417.28
8.1.110.0070.00017.41
8.1.100.0000.00717.38
8.1.90.0040.00417.39
8.1.80.0000.00817.39
8.1.70.0000.00717.38
8.1.60.0040.00417.46
8.1.50.0050.00317.39
8.1.40.0030.00517.36
8.1.30.0000.00817.66
8.1.20.0060.00317.58
8.1.10.0000.00917.48
8.1.00.0040.00417.43
8.0.300.0050.00319.89
8.0.290.0040.00416.75
8.0.280.0030.00318.38
8.0.270.0060.00317.15
8.0.260.0000.00717.34
8.0.250.0030.00517.05
8.0.240.0040.00417.02
8.0.230.0040.00416.98
8.0.220.0000.00716.88
8.0.210.0030.00316.96
8.0.200.0060.00316.99
8.0.190.0000.00716.91
8.0.180.0030.00816.91
8.0.170.0000.00816.98
8.0.160.0000.00716.96
8.0.150.0040.00416.93
8.0.140.0030.00516.91
8.0.130.0000.00613.23
8.0.120.0070.00016.84
8.0.110.0050.00216.82
8.0.100.0030.00516.80
8.0.90.0040.00416.78
8.0.80.0120.00416.80
8.0.70.0000.00816.96
8.0.60.0070.00016.70
8.0.50.0050.00216.91
8.0.30.0060.01217.11
8.0.20.0120.00717.40
8.0.10.0040.00416.98
8.0.00.0090.00916.73
7.4.330.0000.00515.08
7.4.320.0050.00216.42
7.4.300.0060.00016.61
7.4.290.0000.00816.47
7.4.280.0000.00716.62
7.4.270.0000.00716.39
7.4.260.0070.00016.46
7.4.250.0000.00816.42
7.4.240.0020.00516.43
7.4.230.0030.00316.66
7.4.220.0130.00416.49
7.4.210.0060.00916.57
7.4.200.0030.00316.38
7.4.160.0100.00616.61
7.4.150.0060.00917.40
7.4.140.0140.00417.86
7.4.130.0120.00716.40
7.4.120.0060.01316.54
7.4.110.0200.00316.47
7.4.100.0140.01116.52
7.4.90.0140.00316.46
7.4.80.0090.00919.39
7.4.70.0110.00516.54
7.4.60.0030.01916.51
7.4.50.0000.00616.54
7.4.40.0060.01116.64
7.4.30.0060.01216.49
7.4.00.0080.00714.88
7.3.330.0000.00613.15
7.3.320.0030.00313.34
7.3.310.0000.00716.43
7.3.300.0000.00716.35
7.3.290.0090.00716.33
7.3.280.0090.01116.27
7.3.270.0160.00617.40
7.3.260.0120.00616.51
7.3.250.0090.00816.43
7.3.240.0140.00516.49
7.3.230.0110.01216.52
7.3.210.0100.00616.43
7.3.200.0030.01316.34
7.3.190.0180.00316.23
7.3.180.0100.00616.52
7.3.170.0130.00316.41
7.3.160.0080.00816.68
7.3.120.0110.00714.75
7.3.110.0080.00814.63
7.3.100.0050.01114.92
7.3.90.0070.01014.92
7.3.80.0040.00814.88
7.3.70.0090.00714.75
7.3.60.0040.01114.71
7.3.50.0060.00714.69
7.3.40.0120.00314.64
7.3.30.0030.01014.68
7.3.20.0020.01316.53
7.3.10.0050.00616.64
7.3.00.0070.00616.50
7.2.330.0040.01616.73
7.2.320.0070.01016.68
7.2.310.0150.00316.63
7.2.300.0000.01616.55
7.2.290.0070.01016.76
7.2.250.0050.01515.06
7.2.240.0050.01614.99
7.2.230.0070.00714.92
7.2.220.0060.01114.78
7.2.210.0050.00714.92
7.2.200.0060.00815.02
7.2.190.0050.01114.83
7.2.180.0030.00714.91
7.2.170.0060.00914.97
7.2.60.0110.00416.89
7.2.00.0040.01119.54
7.1.330.0060.01015.67
7.1.320.0050.00715.77
7.1.310.0050.00615.79
7.1.300.0130.00115.49
7.1.290.0030.00915.57
7.1.280.0080.00715.54
7.1.270.0080.00515.66
7.1.260.0030.01315.64
7.1.200.0080.00315.67
7.1.100.0000.01418.03
7.1.70.0070.00016.74
7.1.60.0070.01619.50
7.1.50.0030.01716.85
7.1.00.0030.07722.44
7.0.200.0580.00314.55
7.0.60.0070.07019.98
7.0.50.0000.04717.70
7.0.40.0100.08320.05
7.0.30.0230.04720.18
7.0.20.0270.05720.30
7.0.10.0170.04720.34
7.0.00.0100.06720.14
5.6.280.0070.03320.91
5.6.210.0030.04020.77
5.6.200.0100.07318.18
5.6.190.0000.09720.61
5.6.180.3370.05020.45
5.6.170.0200.04320.39
5.6.160.0130.07320.41
5.6.150.0130.05718.27
5.6.140.0030.08318.21
5.6.130.0200.06718.18
5.6.120.0170.07321.16
5.6.110.0030.06721.03
5.6.100.0070.05721.00
5.6.90.0170.04321.04
5.6.80.0100.03320.55
5.5.350.0100.03720.39
5.5.340.0000.04718.07
5.5.330.0100.08720.13
5.5.320.0400.08020.20
5.5.310.0330.06020.30
5.5.300.0070.07018.08
5.5.290.0030.04318.08
5.5.280.0070.08320.91
5.5.270.0070.03720.78
5.5.260.0000.05320.69
5.5.250.0130.07320.63
5.5.240.0070.08020.08
5.4.450.0800.06019.49
5.4.440.0900.06319.70
5.4.430.0700.06019.18
5.4.420.0630.06319.54
5.4.410.0700.06019.25
5.4.400.0570.05719.02
5.4.390.0600.05319.31
5.4.380.0600.06319.29
5.4.370.0730.04319.14
5.4.360.0500.07019.29
5.4.350.0700.04319.29
5.4.340.0670.05019.15
5.4.320.0600.06319.30
5.4.310.1070.06719.01
5.4.300.0830.04719.25
5.4.290.0870.04719.28
5.4.280.0900.06719.15
5.4.270.0900.04719.16
5.4.260.0800.05319.15
5.4.250.0870.05719.37
5.4.240.0700.05719.21
5.4.230.0600.05719.30
5.4.220.0700.04719.28
5.4.210.0670.04719.28
5.4.200.0770.05719.30
5.4.190.0800.05019.36
5.4.180.0870.05319.14
5.4.170.0830.05019.37
5.4.160.0700.05719.27
5.4.150.0830.05018.85
5.4.140.0730.04316.39
5.4.130.0630.05016.35
5.4.120.0730.05716.51
5.4.110.1000.06716.30
5.4.100.0900.05716.63
5.4.90.0830.05316.56
5.4.80.0830.05716.30
5.4.70.0900.05016.66
5.4.60.0700.06716.52
5.4.50.0800.05016.47
5.4.40.0800.06016.55
5.4.30.0530.06016.58
5.4.20.0700.04316.49
5.4.10.0700.05016.61
5.4.00.0930.04715.84

preferences:
91.37 ms | 400 KiB | 5 Q