3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ConstructorException extends Exception {} class Foo extends ArrayObject { public function __construct( $arr = array(), $flags = 0, $iterator = 'FooIterator' ) { parent::__construct( $arr, $flags, $iterator ); } /** * @return ArrayIterator */ public function getIterator() { $class = $this->getIteratorClass(); return new $class($this); } } class FooIterator extends ArrayIterator { function __construct( $array = array(), $flags = 0 ) { unset( $array[0] , $array[1] ); parent::__construct( $array, $flags ); } } try { $f = new Foo( array( 1, 2, 3 ) ); $it = $f->getIterator(); $it->offsetSet(5, 10); $f[7] = 11; while ($it->valid()) { echo $it->key() . ' => ' . $it->current() . "\n"; $it->next(); } if ( get_class( $it ) !== 'FooIterator' ) { throw new Exception( 'Expected iterator to be FooIterator.' ); } die( "FAIL\n" ); } catch ( ConstructorException $e ) { die( "PASS\n" ); } catch ( \Exception $e ) { die( sprintf( "ERROR: %s\n", $e->getMessage() ) ); }

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.5.10.0120.00520.21
8.5.00.0130.01020.18
8.4.150.0020.00014.05
8.4.140.0160.00517.50
8.4.130.0130.00317.82
8.4.120.0150.00520.82
8.4.110.0090.00922.42
8.4.100.0140.00617.96
8.4.90.0080.01018.57
8.4.80.0160.00419.73
8.4.70.0040.00618.13
8.4.60.0110.00918.77
8.4.50.0140.00918.52
8.4.40.0100.01018.13
8.4.30.0100.01017.73
8.4.20.0100.01017.90
8.4.10.0090.00018.07
8.3.280.0110.00918.53
8.3.270.0100.01016.62
8.3.260.0120.00716.60
8.3.250.0130.00618.98
8.3.240.0110.00917.00
8.3.230.0130.00716.81
8.3.220.0130.00617.09
8.3.210.0110.00718.45
8.3.200.0040.00516.40
8.3.190.0120.00717.33
8.3.180.0110.01018.61
8.3.170.0040.00417.10
8.3.160.0100.00316.74
8.3.150.0070.01118.58
8.3.140.0040.01117.13
8.3.130.0030.00618.59
8.3.120.0000.00918.73
8.3.110.0090.00620.94
8.3.100.0030.00624.06
8.3.90.0000.00826.77
8.3.80.0040.00716.88
8.3.70.0090.00616.61
8.3.60.0090.01216.88
8.3.50.0120.00721.09
8.3.40.0100.00718.67
8.3.30.0110.00419.25
8.3.20.0060.00320.30
8.3.10.0040.00423.57
8.3.00.0080.00417.34
8.2.290.0150.00220.32
8.2.280.0050.00718.59
8.2.270.0060.00317.35
8.2.260.0000.00816.87
8.2.250.0030.00616.70
8.2.240.0070.00417.45
8.2.230.0000.01022.58
8.2.220.0060.00337.54
8.2.210.0070.01326.77
8.2.200.0060.00316.88
8.2.190.0170.00316.88
8.2.180.0060.01025.92
8.2.170.0140.00022.96
8.2.160.0100.00322.20
8.2.150.0090.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00421.07
8.2.110.0090.00319.32
8.2.100.0070.00417.89
8.2.90.0050.00319.08
8.2.80.0080.00019.48
8.2.70.0040.00417.63
8.2.60.0000.01018.05
8.2.50.0090.00018.16
8.2.40.0000.00720.46
8.2.30.0050.00218.15
8.2.20.0000.00817.84
8.2.10.0020.00518.11
8.2.00.0000.00718.08
8.1.330.0130.00521.79
8.1.320.0060.00316.37
8.1.310.0000.01018.43
8.1.300.0000.00720.25
8.1.290.0030.00618.88
8.1.280.0190.00025.92
8.1.270.0040.00424.66
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00319.20
8.1.230.0040.00719.05
8.1.220.0040.00417.78
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0000.01017.13
8.1.180.0040.00418.10
8.1.170.0000.00818.61
8.1.160.0060.00322.09
8.1.150.0040.00418.79
8.1.140.0040.00417.41
8.1.130.0000.00717.77
8.1.120.0000.00717.52
8.1.110.0000.00717.30
8.1.100.0050.00517.39
8.1.90.0040.00417.30
8.1.80.0040.00417.52
8.1.70.0000.00717.46
8.1.60.0080.00317.59
8.1.50.0000.01217.38
8.1.40.0050.00317.51
8.1.30.0000.00817.64
8.1.20.0060.00317.50
8.1.10.0040.00417.64
8.1.00.0000.00817.36
8.0.300.0070.00018.77
8.0.290.0050.00216.75
8.0.280.0040.00418.34
8.0.270.0050.00317.20
8.0.260.0060.00017.16
8.0.250.0000.00716.95
8.0.240.0050.00216.93
8.0.230.0070.00017.00
8.0.220.0000.00716.97
8.0.210.0050.00216.88
8.0.200.0070.00017.04
8.0.190.0040.00417.02
8.0.180.0070.00016.96
8.0.170.0050.00316.97
8.0.160.0040.00417.04
8.0.150.0030.00516.99
8.0.140.0040.00416.92
8.0.130.0060.00013.44
8.0.120.0030.00616.97
8.0.110.0000.00716.97
8.0.100.0040.00416.89
8.0.90.0000.00716.92
8.0.80.0150.00917.04
8.0.70.0040.00416.79
8.0.60.0070.00016.98
8.0.50.0040.00416.86
8.0.30.0160.00917.16
8.0.20.0150.00517.42
8.0.10.0070.00017.08
8.0.00.0070.01416.90
7.4.330.0020.00215.14
7.4.320.0000.00816.63
7.4.300.0060.00016.57
7.4.290.0030.00516.52
7.4.280.0000.00816.53
7.4.270.0000.00616.54
7.4.260.0000.01016.56
7.4.250.0040.00416.63
7.4.240.0050.00216.51
7.4.230.0000.00716.43
7.4.220.0150.00316.53
7.4.210.0040.01116.65
7.4.200.0040.00416.47
7.4.160.0030.01216.72
7.4.150.0150.00417.40
7.4.140.0070.01217.86
7.4.130.0130.00716.62
7.4.120.0060.01216.62
7.4.110.0070.01116.55
7.4.100.0200.00316.55
7.4.90.0120.00616.54
7.4.80.0090.01419.39
7.4.70.0150.00416.51
7.4.60.0060.01116.49
7.4.50.0040.00416.60
7.4.40.0090.00616.52
7.4.30.0090.00916.54
7.4.00.0040.00415.10
7.3.330.0000.00513.47
7.3.320.0130.00013.25
7.3.310.0030.00316.49
7.3.300.0030.00316.38
7.3.290.0070.00016.41
7.3.280.0070.00816.49
7.3.270.0140.00317.40
7.3.260.0100.00716.39
7.3.250.0110.00716.38
7.3.240.0130.00316.52
7.3.230.0110.01116.44
7.3.210.0040.01416.66
7.3.200.0170.00619.39
7.3.190.0130.00316.58
7.3.180.0060.00916.70
7.3.170.0200.00316.48
7.3.160.0100.00716.65
7.2.330.0030.01416.65
7.2.320.0060.01216.74
7.2.310.0160.00816.82
7.2.300.0040.01416.74
7.2.290.0100.00716.60
7.2.60.0070.00416.69
7.2.00.0040.00819.21
7.1.200.0070.00015.88
7.1.100.0030.00618.23
7.1.70.0040.00417.37
7.1.60.0000.01317.04
7.1.50.0080.00316.92
7.1.40.0060.00916.68
7.1.30.0030.00716.78
7.1.20.0080.00316.76
7.1.10.0030.00516.65
7.1.00.0000.00816.81
7.0.200.0030.00516.98
7.0.190.0000.00716.76
7.0.180.0040.00416.43
7.0.170.0000.00816.43
7.0.160.0080.00016.43
7.0.150.0000.00816.43
7.0.140.0060.00316.55
7.0.130.0030.01316.69
7.0.120.0030.01316.52
7.0.110.0030.01016.43
7.0.100.0040.00416.46
7.0.90.0030.01016.43
7.0.80.0040.00816.60
7.0.70.0020.00516.43
7.0.60.0090.00616.43
7.0.50.0050.00216.43
7.0.40.0000.00716.43
7.0.30.0060.00916.43
7.0.20.0040.01216.43
7.0.10.0040.00816.43
7.0.00.0070.00316.43
5.6.300.0030.04220.80
5.6.290.0030.04020.79
5.6.280.0030.07420.90
5.6.270.0070.07820.86
5.6.260.0070.04121.03
5.6.250.0030.04520.91
5.6.240.0030.04421.07
5.6.230.0100.08021.01
5.6.220.0000.08020.94
5.6.210.0030.04720.65
5.6.200.0030.05521.03
5.6.190.0030.04521.02
5.6.180.0070.06720.98
5.6.170.0000.04820.86
5.6.160.0070.04221.08
5.6.150.0000.04421.04
5.6.140.0000.07021.01
5.6.130.0070.04621.00
5.6.120.0070.08020.75
5.6.110.0030.04920.75
5.6.100.0030.05120.98
5.6.90.0070.04020.88
5.6.80.0070.04220.35
5.6.70.0060.04220.34
5.6.60.0070.03820.22
5.6.50.0100.03220.41
5.6.40.0030.04120.42
5.6.30.0200.04020.41
5.6.20.0030.06620.40
5.6.10.0000.04520.33
5.6.00.0000.05420.43
5.5.380.0030.05317.68
5.5.370.0060.05517.63
5.5.360.0000.05217.66
5.5.350.0000.04817.59
5.5.340.0060.04218.10
5.5.330.0060.04218.10
5.5.320.0100.03618.10
5.5.310.0030.04818.10
5.5.300.0030.04218.13
5.5.290.0030.04318.10
5.5.280.0030.04618.00
5.5.270.0000.04518.07
5.5.260.0030.04118.09
5.5.250.0030.04317.81
5.5.240.0070.03417.25
5.5.230.0030.04317.49
5.5.220.0030.04017.47
5.5.210.0070.04317.55
5.5.200.0000.04017.35
5.5.190.0030.04817.21
5.5.180.0030.04917.43
5.5.160.0030.03917.42
5.5.150.0000.04017.41
5.5.140.0000.04317.41
5.5.130.0040.03917.35
5.5.120.0000.04117.21
5.5.110.0030.03917.36
5.5.100.0030.04817.34
5.5.90.0030.04217.33
5.5.80.0000.04817.25
5.5.70.0030.03817.28
5.5.60.0030.04017.26
5.5.50.0070.04316.96
5.5.40.0100.03616.95
5.5.30.0030.03817.31
5.5.20.0000.04117.41
5.5.10.0030.03617.32
5.5.00.0030.03817.31
5.4.450.0060.03919.31
5.4.440.0000.04519.38
5.4.430.0000.04019.46
5.4.420.0030.04319.55
5.4.410.0100.03419.38
5.4.400.0070.05219.08
5.4.390.0060.03918.93
5.4.380.0030.03718.96
5.4.370.0100.04919.08
5.4.360.0070.06019.12
5.4.350.0000.04918.96
5.4.340.0030.04518.87
5.4.320.0000.04318.97
5.4.310.0040.04618.90
5.4.300.0000.04018.97
5.4.290.0100.03819.13
5.4.280.0000.04018.86
5.4.270.0070.03619.19
5.4.260.0030.08018.87
5.4.250.0140.04819.05
5.4.240.0000.04219.05
5.4.230.0040.03918.98
5.4.220.0200.04419.20
5.4.210.0000.04219.13
5.4.200.0060.03919.05
5.4.190.0030.03619.10
5.4.180.0030.03718.93
5.4.170.0030.06219.07
5.4.160.0000.04318.88
5.4.150.0030.03918.96
5.4.140.0000.03916.50
5.4.130.0030.03416.54
5.4.120.0100.03016.68
5.4.110.0100.03016.77
5.4.100.0070.03316.52
5.4.90.0000.03616.64
5.4.80.0030.03316.53
5.4.70.0000.03716.43
5.4.60.0030.03316.72
5.4.50.0030.03516.69
5.4.40.0030.03716.52
5.4.30.0030.06916.48
5.4.20.0000.04016.59
5.4.10.0000.03916.73
5.4.00.0030.03216.43
5.3.290.0000.04416.43
5.3.280.0030.03716.43
5.3.270.0070.06316.43
5.3.260.0030.03716.43
5.3.250.0000.04116.43
5.3.240.0040.05316.43
5.3.230.0000.04116.43
5.3.220.0070.04416.43
5.3.210.0030.04016.43
5.3.200.0070.03316.43
5.3.190.0070.05416.43
5.3.180.0000.03816.43
5.3.170.0000.04016.43
5.3.160.0030.05016.43
5.3.150.0030.03516.43
5.3.140.0000.04216.43
5.3.130.0070.03616.43
5.3.120.0030.04216.43
5.3.110.0030.03716.43
5.3.100.0000.04016.43
5.3.90.0000.04416.43
5.3.80.0000.04216.43
5.3.70.0030.03716.43
5.3.60.0030.03416.43
5.3.50.0000.04216.43
5.3.40.0200.05616.43
5.3.30.0000.04616.43
5.3.20.0000.03716.43
5.3.10.0000.03916.43
5.3.00.0030.06216.43
5.2.170.0000.03216.43
5.2.160.0000.05516.43
5.2.150.0030.02716.43
5.2.140.0000.03216.43
5.2.130.0030.02616.43
5.2.120.0030.04316.43
5.2.110.0030.02716.43
5.2.100.0030.03816.43
5.2.90.0000.04216.43
5.2.80.0000.03416.43
5.2.70.0100.02716.43
5.2.60.0100.02616.43
5.2.50.0030.02916.43
5.2.40.0030.02716.43
5.2.30.0030.04116.43
5.2.20.0000.04016.43
5.2.10.0000.03216.43
5.2.00.0000.02916.43
5.1.60.0000.02716.43
5.1.50.0060.02916.43
5.1.40.0060.04216.43
5.1.30.0000.02816.43
5.1.20.0030.03016.43
5.1.10.0000.02916.43
5.1.00.0090.02516.43
5.0.50.0030.02416.43
5.0.40.0070.01616.43
5.0.30.0070.04416.43
5.0.20.0100.03616.43
5.0.10.0030.04316.43
5.0.00.0000.03216.43
4.4.90.0000.02116.43
4.4.80.0000.01616.43
4.4.70.0000.01616.43
4.4.60.0030.02016.43
4.4.50.0030.01616.43
4.4.40.0000.02516.43
4.4.30.0030.03416.43
4.4.20.0030.01316.43
4.4.10.0000.01816.43
4.4.00.0000.03116.43
4.3.110.0070.01016.43
4.3.100.0000.03616.43
4.3.90.0030.01716.43
4.3.80.0000.03216.43
4.3.70.0000.03316.43
4.3.60.0030.02016.43
4.3.50.0000.01816.43
4.3.40.0030.02316.43
4.3.30.0000.01716.43
4.3.20.0070.02316.43
4.3.10.0030.02216.43
4.3.00.0000.01616.43

preferences:
187.06 ms | 403 KiB | 5 Q