3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * An example of duck typing in PHP */ interface CanFly { public function fly(); } interface CanSwim { public function swim(); } class Bird { public function info() { echo "I am a {$this->name}\n"; echo "I am an bird\n"; } } /** * some implementations of birds */ class Dove extends Bird implements CanFly { var $name = "Dove"; public function fly() { echo "I fly\n"; } } class Penguin extends Bird implements CanSwim { var $name = "Penguin"; public function swim() { echo "I swim\n"; } } class Duck extends Bird implements CanFly, CanSwim { var $name = "Duck"; public function fly() { echo "I fly\n"; } public function swim() { echo "I swim\n"; } } /** * a simple function to describe a bird */ function describe($bird) { if ($bird instanceof Bird) { $bird->info(); if ($bird instanceof CanFly) { $bird->fly(); } if ($bird instanceof CanSwim) { $bird->swim(); } } else { die("This is not a bird. I cannot describe it."); } }

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.0160.00616.50
8.3.50.0120.00316.68
8.3.40.0120.00318.73
8.3.30.0070.00718.72
8.3.20.0070.00020.29
8.3.10.0000.00721.88
8.3.00.0080.00017.66
8.2.180.0120.00617.93
8.2.170.0140.00322.96
8.2.160.0070.01020.57
8.2.150.0120.00324.18
8.2.140.0040.00424.66
8.2.130.0120.00620.39
8.2.120.0000.00826.35
8.2.110.0120.00021.00
8.2.100.0080.00417.78
8.2.90.0080.00019.21
8.2.80.0000.00817.97
8.2.70.0000.00817.50
8.2.60.0080.00017.93
8.2.50.0030.00518.10
8.2.40.0080.00022.36
8.2.30.0040.00420.88
8.2.20.0040.00417.89
8.2.10.0040.00418.06
8.2.00.0000.00718.00
8.1.280.0120.00625.92
8.1.270.0040.00423.84
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0000.00921.11
8.1.230.0070.00417.45
8.1.220.0000.00717.74
8.1.210.0000.00818.77
8.1.200.0060.00317.25
8.1.190.0000.00817.23
8.1.180.0000.00718.10
8.1.170.0000.00818.40
8.1.160.0040.00418.97
8.1.150.0030.00620.63
8.1.140.0000.00719.51
8.1.130.0070.00018.82
8.1.120.0040.00417.33
8.1.110.0080.00017.45
8.1.100.0040.00417.30
8.1.90.0000.00717.44
8.1.80.0040.00417.30
8.1.70.0070.00017.41
8.1.60.0030.00617.46
8.1.50.0000.00717.43
8.1.40.0030.00617.47
8.1.30.0060.00317.45
8.1.20.0040.00417.48
8.1.10.0040.00417.29
8.1.00.0040.00417.31
8.0.300.0000.00818.77
8.0.290.0000.00716.75
8.0.280.0000.00718.38
8.0.270.0040.00417.21
8.0.260.0000.00616.64
8.0.250.0030.00316.91
8.0.240.0030.00316.85
8.0.230.0000.01016.78
8.0.220.0000.00716.88
8.0.210.0060.00016.72
8.0.200.0030.00316.87
8.0.190.0000.00816.95
8.0.180.0070.00016.82
8.0.170.0050.00216.89
8.0.160.0000.00716.94
8.0.150.0030.00416.86
8.0.140.0070.00016.84
8.0.130.0030.00313.23
8.0.120.0000.00816.79
8.0.110.0000.00816.73
8.0.100.0000.00716.83
8.0.90.0000.00716.91
8.0.80.0110.01116.90
8.0.70.0040.00416.83
8.0.60.0000.00716.71
8.0.50.0080.00016.80
8.0.30.0060.01116.88
8.0.20.0100.01017.40
8.0.10.0050.00216.85
8.0.00.0000.01816.77
7.4.330.0000.00515.55
7.4.320.0030.00316.54
7.4.300.0020.00516.50
7.4.290.0080.00016.50
7.4.280.0000.00816.47
7.4.270.0040.00416.54
7.4.260.0050.00013.27
7.4.250.0070.00016.41
7.4.240.0030.00316.55
7.4.230.0000.00716.58
7.4.220.0140.01216.54
7.4.210.0080.01116.54
7.4.200.0000.00716.57
7.4.160.0030.01316.37
7.4.150.0120.00917.40
7.4.140.0090.01117.86
7.4.130.0070.01316.48
7.4.120.0120.00816.41
7.4.110.0190.00016.47
7.4.100.0120.00616.45
7.4.90.0100.00716.52
7.4.80.0130.00919.39
7.4.70.0100.01016.29
7.4.60.0100.01016.65
7.4.50.0070.01116.50
7.4.40.0160.00016.52
7.4.30.0060.01116.37
7.4.10.0060.00815.03
7.4.00.0070.01014.88
7.3.330.0000.00613.25
7.3.320.0030.00313.29
7.3.310.0030.00316.30
7.3.300.0030.00316.14
7.3.290.0000.00716.30
7.3.280.0080.00816.21
7.3.270.0130.00617.40
7.3.260.0090.00916.24
7.3.250.0130.00616.41
7.3.240.0100.00716.36
7.3.230.0050.01816.31
7.3.210.0100.00616.22
7.3.200.0060.01216.37
7.3.190.0050.01116.27
7.3.180.0080.00816.30
7.3.170.0000.01516.27
7.3.160.0120.00316.33
7.3.130.0070.00914.68
7.3.120.0050.01314.71
7.3.110.0050.01414.85
7.3.100.0070.00914.78
7.3.90.0080.00614.65
7.3.80.0050.01014.76
7.3.70.0000.01314.64
7.3.60.0080.00714.65
7.3.50.0010.01214.77
7.3.40.0050.00714.81
7.3.30.0070.00914.69
7.3.20.0070.00716.63
7.3.10.0080.00416.45
7.3.00.0090.00616.57
7.2.330.0000.01816.39
7.2.320.0090.01316.43
7.2.310.0070.01316.37
7.2.300.0070.01016.38
7.2.290.0040.01216.27
7.2.260.0100.00714.82
7.2.250.0120.00715.03
7.2.240.0030.01314.83
7.2.230.0050.00914.92
7.2.220.0060.01114.84
7.2.210.0040.01214.99
7.2.200.0040.00914.85
7.2.190.0070.00614.94
7.2.180.0090.00614.83
7.2.170.0030.00914.85
7.2.160.0020.01414.96
7.2.150.0070.01216.87
7.2.140.0140.00316.84
7.2.130.0090.00816.81
7.2.120.0020.01016.76
7.2.110.0060.00916.58
7.2.100.0090.00516.61
7.2.90.0180.00516.00
7.2.80.0070.00915.78
7.2.70.0580.00916.24
7.2.60.0090.00816.11
7.2.50.0060.00916.13
7.2.40.0030.01115.96
7.2.30.0350.01116.17
7.2.20.0210.00716.09
7.2.10.0160.00516.01
7.2.00.0060.01016.16
7.1.330.0030.01115.67
7.1.320.0080.00915.56
7.1.310.0060.00615.48
7.1.300.0080.00715.60
7.1.290.0050.00915.48
7.1.280.0050.00715.64
7.1.270.0040.01015.46
7.1.260.0060.00915.84
7.1.250.0020.01115.71
7.1.240.0040.01015.70
7.1.230.0060.00915.60
7.1.220.0050.01015.55
7.1.210.0460.00414.82
7.1.200.0060.01014.83
7.1.190.0190.00514.90
7.1.180.0060.00714.97
7.1.170.0150.00814.93
7.1.160.0060.00814.83
7.1.150.0060.01014.84
7.1.140.0840.00614.93
7.1.130.0390.00815.02
7.1.120.0110.00514.89
7.1.110.0060.01014.94
7.1.100.0060.00814.81
7.1.90.0460.00215.12
7.1.80.0490.00715.01
7.1.70.0060.01214.97
7.1.60.0110.01421.03
7.1.50.0380.01020.96
7.1.40.0160.00820.93
7.1.30.0140.01120.91
7.1.20.0280.00720.90
7.1.10.0080.00814.96
7.1.00.1080.00815.04
7.0.330.0060.00515.35
7.0.320.0050.01015.31
7.0.310.0050.00714.50
7.0.300.0370.00814.69
7.0.290.0100.00914.65
7.0.280.0170.01014.54
7.0.270.0570.00714.64
7.0.260.0110.00514.58
7.0.250.0190.00414.80
7.0.240.0090.00614.74
7.0.230.0060.00714.61
7.0.220.0070.00714.68
7.0.210.0070.00614.66
7.0.200.0060.01114.49
7.0.190.0970.00414.57
7.0.180.0580.00714.57
7.0.170.0110.00414.62
7.0.160.0080.00714.61
7.0.150.0180.00514.44
7.0.140.0080.00614.53
7.0.130.0080.00714.65
7.0.120.0060.00714.60
7.0.110.0070.00414.73
7.0.100.0210.00614.57
7.0.90.0050.00714.66
7.0.80.0140.00814.60
7.0.70.0110.00714.65
7.0.60.0060.00914.52
7.0.50.0060.00514.84
7.0.40.0050.00913.84
7.0.30.0090.00413.88
7.0.20.0180.00313.79
7.0.10.0150.01113.78
7.0.00.0340.01213.77
5.6.400.0000.01214.24
5.6.390.0080.00314.23
5.6.380.0030.01214.17
5.6.370.0070.00314.43
5.6.360.0080.00314.40
5.6.350.0050.01114.32
5.6.340.0030.01014.53
5.6.330.0100.00514.53
5.6.320.0050.00914.50
5.6.310.0060.00514.57
5.6.300.0020.01314.57
5.6.290.0070.00614.51
5.6.280.0070.00314.57
5.6.270.0040.01114.59
5.6.260.0060.00614.45
5.6.250.0040.01114.45
5.6.240.0040.00814.29
5.6.230.0060.00614.44
5.6.220.0120.00614.34
5.6.210.0050.00814.41
5.6.200.0050.00314.31
5.6.190.0060.00614.40
5.6.180.0020.01314.50
5.6.170.0050.00614.45
5.6.160.0070.00514.44
5.6.150.0030.00614.30
5.6.140.0010.00714.37
5.6.130.0030.01014.38
5.6.120.0070.00714.58
5.6.110.0040.00714.36
5.6.100.0050.01114.33
5.6.90.0050.00814.37
5.6.80.0030.01214.38
5.6.70.0060.00514.26
5.6.60.0030.00814.21
5.6.50.0040.00914.29
5.6.40.0070.00714.32
5.6.30.0030.01014.44
5.6.20.0040.00914.34
5.6.10.0080.00714.49
5.6.00.0070.00714.42

preferences:
40.13 ms | 401 KiB | 5 Q