3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Animal { protected $color; protected $length; private function __construct(){} public static function fromLength($length) { $animal = new self(); $animal->length = $length; return $animal; } public static function fromColor($color) { $animal = new static(); $animal->color = $color; return $animal; } } class Dog extends Animal { } class Snake extends Animal { } $myAnimal = Animal::fromColor('red'); $mySnake = Snake::fromLength(10); $myDog = Dog::fromColor('brown'); var_dump($myAnimal); var_dump($mySnake); var_dump($myDog);

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.0040.01116.63
8.3.50.0220.00522.14
8.3.40.0100.01018.50
8.3.30.0090.00919.13
8.3.20.0000.00820.29
8.3.10.0030.00623.48
8.3.00.0060.00319.01
8.2.180.0120.00918.42
8.2.170.0090.00622.96
8.2.160.0080.00620.30
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0060.00322.30
8.2.110.0060.00322.21
8.2.100.0110.00017.71
8.2.90.0040.00419.05
8.2.80.0000.00817.97
8.2.70.0060.00317.63
8.2.60.0030.00617.90
8.2.50.0060.00618.07
8.2.40.0040.00419.86
8.2.30.0070.00018.27
8.2.20.0040.00417.59
8.2.10.0030.00617.88
8.2.00.0030.00517.60
8.1.280.0150.00025.92
8.1.270.0050.00323.84
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00323.89
8.1.230.0040.00719.22
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0080.00017.35
8.1.190.0000.00817.23
8.1.180.0030.00618.10
8.1.170.0030.00518.62
8.1.160.0000.00821.99
8.1.150.0000.00818.59
8.1.140.0050.00217.39
8.1.130.0040.00417.79
8.1.120.0000.00717.37
8.1.110.0040.00417.45
8.1.100.0000.00817.25
8.1.90.0000.00817.36
8.1.80.0060.00317.46
8.1.70.0080.00017.38
8.1.60.0020.00517.61
8.1.50.0040.00417.53
8.1.40.0060.00317.39
8.1.30.0000.00817.56
8.1.20.0000.00817.67
8.1.10.0030.00617.41
8.1.00.0000.00917.47
8.0.300.0080.00018.77
8.0.290.0000.00716.93
8.0.280.0040.00418.39
8.0.270.0070.00017.20
8.0.260.0070.00017.24
8.0.250.0000.00716.91
8.0.240.0000.00716.86
8.0.230.0070.00016.92
8.0.220.0070.00016.71
8.0.210.0000.00716.80
8.0.200.0040.00416.92
8.0.190.0000.00716.91
8.0.180.0070.00016.88
8.0.170.0000.00716.93
8.0.160.0030.00316.83
8.0.150.0070.00016.77
8.0.140.0000.00816.71
8.0.130.0040.00413.30
8.0.120.0040.00416.80
8.0.110.0000.00716.68
8.0.100.0040.00416.73
8.0.90.0000.00716.71
8.0.80.0090.00616.79
8.0.70.0070.00016.81
8.0.60.0040.00416.83
8.0.50.0040.00416.89
8.0.30.0140.00717.04
8.0.20.0120.00617.40
8.0.10.0000.00817.01
8.0.00.0080.01116.80
7.4.330.0030.00315.09
7.4.320.0060.00016.34
7.4.300.0000.00616.59
7.4.290.0050.00516.61
7.4.280.0000.00816.59
7.4.270.0000.00816.54
7.4.260.0070.00016.62
7.4.250.0080.00016.54
7.4.240.0050.00216.52
7.4.230.0000.00716.54
7.4.220.0190.00616.55
7.4.210.0070.00916.52
7.4.200.0030.00416.31
7.4.190.0020.00516.52
7.4.160.0120.00916.28
7.4.150.0040.01617.40
7.4.140.0110.00817.86
7.4.130.0100.00816.46
7.4.120.0090.00816.48
7.4.110.0160.00416.50
7.4.100.0150.01116.21
7.4.90.0140.00916.43
7.4.80.0130.00919.39
7.4.70.0090.00916.16
7.4.60.0060.00916.51
7.4.50.0040.00016.46
7.4.40.0130.00316.52
7.4.30.0100.00716.41
7.4.00.0050.00814.99
7.3.330.0030.00313.18
7.3.320.0070.00013.21
7.3.310.0000.00716.34
7.3.300.0030.00316.10
7.3.290.0090.00616.25
7.3.280.0080.01016.21
7.3.270.0080.00817.40
7.3.260.0100.00716.25
7.3.250.0060.01116.25
7.3.240.0090.00916.47
7.3.230.0170.00016.39
7.3.210.0120.00916.43
7.3.200.0110.00719.39
7.3.190.0070.01616.31
7.3.180.0030.01216.31
7.3.170.0030.01716.27
7.3.160.0080.00816.54
7.3.120.0030.01014.79
7.3.00.0040.01116.52
7.2.330.0110.00716.51
7.2.320.0100.01016.55
7.2.310.0110.00716.73
7.2.300.0090.01316.64
7.2.290.0090.01216.47
7.2.130.0120.00316.86
7.2.120.0070.00316.71
7.2.110.0040.00416.49
7.2.100.0090.00916.60
7.2.90.0120.00316.86
7.2.80.0070.00716.93
7.2.70.0070.00716.84
7.2.60.0170.00016.66
7.2.50.0000.01616.86
7.2.40.0000.01516.93
7.2.30.0070.00316.89
7.2.20.0100.00716.83
7.2.10.0070.01016.59
7.2.00.0050.01118.10
7.1.250.0030.00715.95
7.1.240.0040.00415.91
7.1.230.0110.00415.71
7.1.220.0030.01015.89
7.1.210.0070.00715.50
7.1.200.0080.00415.68
7.1.190.0040.00815.63
7.1.180.0090.00315.69
7.1.170.0100.00315.56
7.1.160.0100.00315.23
7.1.150.0090.00315.88
7.1.140.0080.00415.84
7.1.130.0000.01415.68
7.1.120.0070.01015.41
7.1.110.0030.01415.69
7.1.100.0060.00916.62
7.1.90.0030.00915.79
7.1.80.0000.01015.53
7.1.70.0070.00516.47
7.1.60.0050.00917.50
7.1.50.0150.00725.37
7.1.40.0000.01315.69
7.1.30.0080.00415.64
7.1.20.0070.00315.59
7.1.10.0000.01615.53
7.1.00.0030.04119.21
7.0.330.0090.00015.25
7.0.320.0000.01015.14
7.0.310.0060.00615.36
7.0.300.0000.01115.30
7.0.290.0040.01114.93
7.0.280.0070.00315.19
7.0.270.0040.00815.30
7.0.260.0040.00715.10
7.0.250.0060.00915.49
7.0.240.0070.00715.14
7.0.230.0000.01315.18
7.0.220.0060.00615.31
7.0.210.0030.00715.16
7.0.200.0010.01016.06
7.0.190.0060.00615.34
7.0.180.0060.00615.38
7.0.170.0140.00015.23
7.0.160.0060.00615.06
7.0.150.0070.00715.57
7.0.140.0070.03818.57
7.0.130.0040.00815.30
7.0.120.0080.00615.36
7.0.110.0110.00315.41
7.0.100.0060.00315.12
7.0.90.0080.00315.37
7.0.80.0060.00615.00
7.0.70.0060.00315.40
7.0.60.0050.04817.61
7.0.50.0100.04316.67
7.0.40.0030.02816.84
7.0.30.0150.04416.87
7.0.20.0180.03216.81
7.0.10.0080.04516.80
7.0.00.0030.03016.68
5.6.380.0060.00314.14
5.6.370.0080.00814.07
5.6.360.0070.00714.19
5.6.350.0000.01414.44
5.6.340.0060.00614.29
5.6.330.0030.00614.35
5.6.320.0000.01214.48
5.6.310.0070.00714.64
5.6.300.0030.00514.54
5.6.290.0040.01114.60
5.6.280.0030.04117.75
5.6.270.0050.00514.63
5.6.260.0000.01414.26
5.6.250.0110.00413.96
5.6.240.0100.00314.25
5.6.230.0000.01214.63
5.6.220.0030.00914.44
5.6.210.0020.03717.43
5.6.200.0110.04216.19
5.6.190.0070.02417.48
5.6.180.0250.04017.48
5.6.170.0100.02317.24
5.6.160.0090.04017.25
5.6.150.0070.03816.36
5.6.140.0010.02816.12
5.6.130.0030.05216.20
5.6.120.0070.03017.54
5.6.110.0130.02317.64
5.6.100.0050.04917.66
5.6.90.0010.04217.59
5.6.80.0100.04217.30
5.6.70.0040.01114.08
5.6.60.0000.01414.28
5.6.50.0060.00614.05
5.6.40.0140.00314.27
5.6.30.0060.00614.08
5.6.20.0130.00314.12
5.6.10.0070.00714.14
5.6.00.0070.01114.21
5.5.380.0070.00310.95
5.5.370.0030.00310.96
5.5.360.0040.00411.09
5.5.350.0160.03315.87
5.5.340.0070.03314.54
5.5.330.0060.04815.75
5.5.320.0050.03615.75
5.5.310.0170.03715.79
5.5.300.0030.02614.56
5.5.290.0030.03814.75
5.5.280.0020.02516.17
5.5.270.0030.04615.90
5.5.260.0150.03516.06
5.5.250.0050.02615.71
5.5.240.0070.03315.63
5.5.230.0030.00311.20
5.5.220.0070.00710.81
5.5.210.0000.00811.10
5.5.200.0080.00011.18
5.5.190.0000.00511.25
5.5.180.0080.00310.88
5.5.170.0030.00710.88
5.5.160.0000.00610.86
5.5.150.0000.00911.22
5.5.140.0060.00611.17
5.5.130.0030.00610.93
5.5.120.0080.00311.09
5.5.110.0030.00311.07
5.5.100.0060.00611.20
5.5.90.0030.00710.84
5.5.80.0040.00410.55
5.5.70.0050.00311.19
5.5.60.0040.00710.94
5.5.50.0030.01011.01
5.5.40.0030.00711.30
5.5.30.0070.00710.60
5.5.20.0070.00711.29
5.5.10.0040.01110.80
5.5.00.0000.00811.00
5.4.450.0300.03815.06
5.4.440.0380.03615.28
5.4.430.0350.03215.28
5.4.420.0080.03015.29
5.4.410.0120.02715.30
5.4.400.0070.03215.16
5.4.390.0070.03015.15
5.4.380.0150.03614.75
5.4.370.0080.02514.75
5.4.360.0050.02314.73
5.4.350.0040.01911.46
5.4.340.0030.02211.49
5.4.330.0060.00310.79
5.4.320.0060.02111.59
5.4.310.0060.02311.67
5.4.300.0090.02811.59
5.4.290.0110.02711.57
5.4.280.0040.03111.62
5.4.270.0090.02811.67
5.4.260.0150.05011.63
5.4.250.0080.02811.73
5.4.240.0080.02711.63
5.4.230.0090.03011.59
5.4.220.0070.02811.63
5.4.210.0090.03911.52
5.4.200.0050.03011.66
5.4.190.0070.04511.57
5.4.180.0070.03211.63
5.4.170.0100.02711.81
5.4.160.0090.03211.73
5.4.150.0150.03811.68
5.4.140.0080.03011.60
5.4.130.0110.02611.48
5.4.120.0130.05511.31
5.4.110.0080.03411.30
5.4.100.0120.04311.59
5.4.90.0070.04711.45
5.4.80.0040.03111.46
5.4.70.0090.02611.56
5.4.60.0080.03011.53
5.4.50.0080.02711.55
5.4.40.0080.02811.56
5.4.30.0100.02411.45
5.4.20.0040.03911.31
5.4.10.0080.02511.40
5.4.00.0080.02611.24
5.3.290.0090.02111.76
5.3.280.0050.02611.69
5.3.270.0070.02411.70
5.3.260.0060.03111.76
5.3.250.0090.02711.69
5.3.240.0060.02411.54
5.3.230.0080.02211.68
5.3.220.0060.02711.45
5.3.210.0080.02511.49
5.3.200.0090.03111.44
5.3.190.0090.03611.53
5.3.180.0070.02911.64
5.3.170.0070.02711.67
5.3.160.0050.02511.67
5.3.150.0070.02711.52
5.3.140.0070.04211.59
5.3.130.0090.03711.54
5.3.120.0080.03511.43
5.3.110.0100.04011.54
5.3.100.0040.02711.32
5.3.90.0060.02811.31
5.3.80.0180.04511.30
5.3.70.0080.03511.31
5.3.60.0070.04811.34
5.3.50.0030.03511.14
5.3.40.0080.02911.32
5.3.30.0050.03111.11
5.3.20.0080.02811.14
5.3.10.0140.04611.07
5.3.00.0100.04711.03
5.2.170.0070.0199.32
5.2.160.0070.0189.37
5.2.150.0060.0209.32
5.2.140.0040.0239.32
5.2.130.0050.0209.30
5.2.120.0060.0269.30
5.2.110.0130.0339.31
5.2.100.0070.0279.30
5.2.90.0070.0299.30
5.2.80.0070.0229.30
5.2.70.0050.0249.30
5.2.60.0080.0359.27
5.2.50.0110.0339.26
5.2.40.0050.0379.25
5.2.30.0070.0299.24
5.2.20.0090.0179.23
5.2.10.0020.0229.18
5.2.00.0050.0239.12
5.1.60.0060.0178.76
5.1.50.0080.0248.75
5.1.40.0090.0258.75
5.1.30.0070.0168.92
5.1.20.0070.0268.93
5.1.10.0080.0228.79
5.1.00.0050.0548.79
5.0.50.0050.0208.03
5.0.40.0090.0207.96
5.0.30.0060.0317.87
5.0.20.0050.0217.85
5.0.10.0060.0177.84
5.0.00.0050.0197.84
4.4.90.0030.0127.10
4.4.80.0060.0207.09
4.4.70.0060.0157.08
4.4.60.0030.0157.08
4.4.50.0150.0417.09
4.4.40.0040.0207.06
4.4.30.0070.0187.09
4.4.20.0060.0167.13
4.4.10.0000.0217.13
4.4.00.0030.0167.09
4.3.110.0040.0117.04
4.3.100.0020.0107.04
4.3.90.0040.0197.03
4.3.80.0040.0177.00
4.3.70.0040.0087.02
4.3.60.0030.0107.02
4.3.50.0040.0097.02
4.3.40.0020.0136.98
4.3.30.0020.0096.36
4.3.20.0030.0116.35
4.3.10.0030.0106.33
4.3.00.0080.0108.67

preferences:
45.52 ms | 401 KiB | 5 Q