3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface bird { function setKind(string $type); function getKind(); function getLocation(); function setLocation(location $location); function flyTo(location $location); function setMelody(string $melody); function singMelody(); function killBird(); function cloneBird(int $count); } abstract class location{ private $x; private $y; private $z; } class Position extends location { private $x; private $y; private $z; function set(int $x, int $y, int $z) { $this->x = $x; $this->y = $y; $this->z = $z; } function get() { return [ $this->x, $this->y, $this->z ]; } function __construct(int $x, int $y, int $z) { $this->set($x,$y,$z); } } class BirdFactory implements Iterator { private $position = 0; private $count; private $object; function __construct(int $count, bird $object) { $this->count = $count; $this->object = $object; } function rewind() { $this->position = 0; } function current() { return clone $this->object; } function key() { return $this->position; } function next() { ++$this->position; } function valid() { return $this->position < $this->count; } } abstract class AbstractBird implements bird { private $kind; private $location; private $melody; private $isAlive = true; function __construct() { $this->setLocation(new Position(0, 0, 0)); } function setKind(string $type) { $this->kind = $type; } function getKind() { return $this->kind; } function setLocation(location $location) { $this->location = $location; } function getLocation() { return $this->location; } function flyTo(location $location) { $this->location = $location; } function setMelody(string $melody) { $this->melody = $melody; } function singMelody() { return $this->melody; } function killBird() { return $this->isAlive = false; } function cloneBird(int $count){ return new BirdFactory($count, $this); } } class Duck extends AbstractBird { function __construct() { parent::__construct(); $this->setKind('Duck'); $this->setMelody('Quack! Quack!'); } } class Crow extends AbstractBird { function __construct() { parent::__construct(); $this->setKind('Crow'); $this->setMelody('Caw! Caw!'); } } class Penguin extends AbstractBird { function __construct() { parent::__construct(); $this->setKind('Penguin'); $this->setMelody('Ping! Ping!'); } function flyTo(location $location) { throw new Exception('Sorry, Penguins can\'t fly :('); } }

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.0130.01018.43
8.3.50.0100.00922.05
8.3.40.0150.00018.60
8.3.30.0090.01318.63
8.3.20.0000.00820.39
8.3.10.0030.00520.53
8.3.00.0000.00820.46
8.2.180.0120.00318.29
8.2.170.0080.00822.96
8.2.160.0120.00319.32
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0050.00326.16
8.2.120.0040.00419.77
8.2.110.0070.00322.24
8.2.100.0000.01017.91
8.2.90.0000.00817.91
8.2.80.0000.00819.32
8.2.70.0040.00417.80
8.2.60.0060.00317.92
8.2.50.0040.00518.10
8.2.40.0080.00320.65
8.2.30.0060.00319.29
8.2.20.0030.00517.73
8.2.10.0030.00518.10
8.2.00.0000.00718.09
8.1.280.0090.00625.92
8.1.270.0080.00023.96
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0050.00522.33
8.1.230.0040.00820.89
8.1.220.0000.00817.74
8.1.210.0050.00318.79
8.1.200.0090.00017.25
8.1.190.0050.00517.22
8.1.180.0050.00318.10
8.1.170.0000.00818.56
8.1.160.0040.00422.16
8.1.150.0030.00618.63
8.1.140.0000.00819.57
8.1.130.0000.00717.68
8.1.120.0000.00717.48
8.1.110.0000.00717.36
8.1.100.0050.00317.43
8.1.90.0030.00617.48
8.1.80.0040.00417.47
8.1.70.0030.00517.46
8.1.60.0040.00417.45
8.1.50.0030.00617.51
8.1.40.0030.00517.40
8.1.30.0050.00317.59
8.1.20.0060.00317.58
8.1.10.0000.00817.41
8.1.00.0000.00917.33
8.0.300.0050.00321.71
8.0.290.0040.00416.63
8.0.280.0030.00318.43
8.0.270.0070.00017.25
8.0.260.0000.00717.30
8.0.250.0070.00016.88
8.0.240.0000.00716.92
8.0.230.0060.00316.93
8.0.220.0080.00016.74
8.0.210.0020.00516.86
8.0.200.0030.00316.93
8.0.190.0030.00716.90
8.0.180.0040.00416.92
8.0.170.0000.00816.95
8.0.160.0040.00416.78
8.0.150.0050.00216.86
8.0.140.0070.00016.81
8.0.130.0060.00013.31
8.0.120.0080.00016.83
8.0.110.0070.00016.77
8.0.100.0000.00716.78
8.0.90.0050.00216.92
8.0.80.0120.00316.86
8.0.70.0050.00316.89
8.0.60.0050.00216.79
8.0.50.0000.00816.84
8.0.30.0070.01317.07
8.0.20.0100.01217.40
8.0.10.0060.00316.80
8.0.00.0130.00716.75
7.4.330.0030.00315.08
7.4.320.0000.00616.56
7.4.300.0000.00616.50
7.4.290.0000.00816.59
7.4.280.0060.00316.64
7.4.270.0030.00516.46
7.4.260.0040.00416.46
7.4.250.0080.00016.43
7.4.240.0040.00316.57
7.4.230.0000.00716.57
7.4.220.0070.01416.57
7.4.210.0080.00616.52
7.4.200.0040.00416.40
7.4.160.0040.01116.51
7.4.150.0100.01417.40
7.4.140.0080.01017.86
7.4.130.0070.01016.40
7.4.120.0060.01116.46
7.4.110.0160.00616.57
7.4.100.0180.00416.68
7.4.90.0070.01116.49
7.4.80.0090.00819.39
7.4.70.0090.00916.54
7.4.60.0030.01316.27
7.4.50.0000.01316.41
7.4.40.0060.01216.53
7.4.30.0060.01016.30
7.4.10.0090.00916.44
7.4.00.0110.00615.51
7.3.330.0000.00513.07
7.3.320.0030.00313.11
7.3.310.0030.00316.11
7.3.300.0070.00016.13
7.3.290.0080.00916.31
7.3.280.0060.01316.33
7.3.270.0080.00917.40
7.3.260.0130.00316.36
7.3.250.0100.00916.34
7.3.240.0140.00816.41
7.3.230.0080.00816.49
7.3.210.0060.01216.29
7.3.200.0160.00716.50
7.3.190.0110.00716.38
7.3.180.0090.00616.59
7.3.170.0080.00816.45
7.3.160.0120.01216.26
7.3.130.0090.00916.44
7.3.120.0030.01615.65
7.3.110.0070.00915.61
7.3.100.0080.00715.57
7.3.90.0080.00715.50
7.3.80.0070.00715.48
7.3.70.0070.00715.49
7.3.60.0050.01215.63
7.3.50.0070.00715.44
7.3.40.0040.01015.66
7.3.30.0070.00515.32
7.3.20.0090.00317.20
7.3.10.0050.00817.38
7.3.00.0070.00417.12
7.2.330.0070.01116.45
7.2.320.0090.00916.32
7.2.310.0070.01116.44
7.2.300.0070.01116.58
7.2.290.0130.00316.67
7.2.260.0030.01716.55
7.2.250.0090.01015.65
7.2.240.0070.01015.78
7.2.230.0060.01015.77
7.2.220.0070.00715.84
7.2.210.0060.00815.59
7.2.200.0070.00515.78
7.2.190.0040.00915.60
7.2.180.0040.00815.70
7.2.170.0040.01215.70
7.2.160.0030.01716.36
7.2.150.0070.00418.26
7.2.140.0070.00718.19
7.2.130.0080.00818.22
7.2.120.0070.01118.23
7.2.110.0120.00418.38
7.2.100.0070.00718.17
7.2.90.0060.00618.19
7.2.80.0120.00618.21
7.2.70.0040.01218.12
7.2.60.0050.01117.50
7.2.50.0030.01518.33
7.2.40.0060.00618.36
7.2.30.0060.00618.05
7.2.20.0060.00918.23
7.2.10.0090.00318.29
7.2.00.0030.00818.68
7.1.330.0070.00716.50
7.1.320.0050.00916.41
7.1.310.0080.00516.56
7.1.300.0040.00916.30
7.1.290.0030.01116.54
7.1.280.0020.01116.55
7.1.270.0100.00516.43
7.1.260.0050.01016.43
7.1.250.0060.01217.19
7.1.240.0070.00717.20
7.1.230.0070.01017.21
7.1.220.0030.01017.23
7.1.210.0070.01017.17
7.1.200.0050.00916.35
7.1.190.0120.00617.16
7.1.180.0060.00317.08
7.1.170.0100.00717.23
7.1.160.0030.01317.23
7.1.150.0040.01117.19
7.1.140.0100.00317.07
7.1.130.0000.01516.94
7.1.120.0080.01217.30
7.1.110.0100.00717.00
7.1.100.0060.00617.28
7.1.90.0000.00917.10
7.1.80.0030.01017.32
7.1.70.0020.00917.16
7.1.60.0050.01318.17
7.1.50.0030.01017.29
7.1.40.0030.01217.11
7.1.30.0040.00717.32
7.1.20.0070.01017.11
7.1.10.0030.00617.27
7.1.00.0070.04019.70
7.0.330.0030.01117.02
7.0.320.0060.00317.12
7.0.310.0130.00316.72
7.0.300.0110.00716.96
7.0.290.0090.00616.93
7.0.280.0070.00716.85
7.0.270.0030.01216.88
7.0.260.0040.01116.98
7.0.250.0160.00316.84
7.0.240.0090.00316.88
7.0.230.0000.01216.76
7.0.220.0070.00716.79
7.0.210.0060.00616.70
7.0.200.0030.00716.81
7.0.190.0040.01116.80
7.0.180.0060.00616.76
7.0.170.0030.01416.66
7.0.160.0110.00716.93
7.0.150.0030.00916.83
7.0.140.0000.01116.92
7.0.130.0000.01616.92
7.0.120.0070.00717.02
7.0.110.0040.00416.85
7.0.100.0060.00616.70
7.0.90.0030.00617.02
7.0.80.0120.00916.75
7.0.70.0080.00416.89
7.0.60.0140.04319.38
7.0.50.0080.04017.36
7.0.40.0080.03817.44
7.0.30.0140.02917.49
7.0.20.0120.05117.55
7.0.10.0050.02817.54
7.0.00.0130.01717.39
5.6.400.0080.00416.12
5.6.390.0100.00315.73
5.6.380.0090.00315.91
5.6.370.0030.01016.07
5.6.360.0100.00715.79
5.6.350.0090.00916.13
5.6.340.0000.01415.79
5.6.330.0040.01115.72
5.6.320.0030.01715.82
5.6.310.0070.01015.83
5.6.300.0040.00715.96
5.6.290.0060.00915.67
5.6.280.0050.03718.54
5.6.270.0100.00315.86
5.6.260.0030.01015.87
5.6.250.0030.00715.92
5.6.240.0100.00715.83
5.6.230.0070.01015.76
5.6.220.0030.01015.83
5.6.210.0160.02318.12
5.6.200.0070.02417.05
5.6.190.0050.04818.19
5.6.180.0170.03818.16
5.6.170.0130.03018.07
5.6.160.0050.04518.17
5.6.150.0030.02516.88
5.6.140.0070.02417.02
5.6.130.0180.03716.95
5.6.120.0020.02718.38
5.6.110.0120.04218.41
5.6.100.0080.03718.41
5.6.90.0070.04518.42
5.6.80.0020.04118.06
5.6.70.0000.01515.66
5.6.60.0110.00015.73
5.6.50.0000.00915.94
5.6.40.0060.00315.60
5.6.30.0040.00815.80
5.6.20.0030.01015.64
5.6.10.0060.00315.66
5.6.00.0040.01115.64
5.5.380.0030.01015.55
5.5.370.0100.01015.53
5.5.360.0090.00915.60
5.5.350.0120.03317.99
5.5.340.0070.02816.69
5.5.330.0080.04617.81
5.5.320.0170.04417.95
5.5.310.0200.04317.93
5.5.300.0090.03616.87
5.5.290.0130.03716.86
5.5.280.0060.04318.28
5.5.270.0030.02818.16
5.5.260.0050.04718.15
5.5.250.0080.04018.18
5.5.240.0080.02017.92
5.5.230.0110.00015.35
5.5.220.0070.01015.80
5.5.210.0100.00315.64
5.5.200.0060.00315.52
5.5.190.0000.01115.49
5.5.180.0070.00715.39
5.5.170.0030.01015.63
5.5.160.0000.01415.45
5.5.150.0070.01115.44
5.5.140.0130.00315.71
5.5.130.0040.00715.62
5.5.120.0070.00715.63
5.5.110.0100.00715.26
5.5.100.0030.01215.29
5.5.90.0030.01215.36
5.5.80.0030.01015.41
5.5.70.0110.00415.49
5.5.60.0040.01115.40
5.5.50.0030.00715.46
5.5.40.0070.00315.73
5.5.30.0080.00415.51
5.5.20.0040.00815.32
5.5.10.0110.00315.24
5.5.00.0080.00315.34

preferences:
64.48 ms | 401 KiB | 5 Q