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."); } } echo describe("Duck");

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.01116.38
8.3.50.0120.00316.17
8.3.40.0150.00018.58
8.3.30.0140.00418.84
8.3.20.0070.00020.21
8.3.10.0040.00421.69
8.3.00.0000.00817.78
8.2.180.0140.00316.50
8.2.170.0070.01022.96
8.2.160.0030.01420.57
8.2.150.0120.00324.18
8.2.140.0050.00224.66
8.2.130.0040.00420.56
8.2.120.0070.00026.35
8.2.110.0090.00020.24
8.2.100.0000.01117.84
8.2.90.0090.00017.63
8.2.80.0030.00618.79
8.2.70.0090.00017.63
8.2.60.0080.00017.50
8.2.50.0060.00317.80
8.2.40.0040.00418.04
8.2.30.0070.00317.68
8.2.20.0000.00818.13
8.2.10.0040.00418.01
8.2.00.0000.00817.98
8.1.270.0080.00023.91
8.1.260.0080.00026.35
8.1.250.0060.00328.09
8.1.240.0060.00622.13
8.1.230.0060.00620.83
8.1.220.0050.00318.62
8.1.210.0050.00318.77
8.1.200.0000.00817.35
8.1.190.0080.00017.22
8.1.180.0030.00518.10
8.1.170.0060.00317.62
8.1.160.0070.00018.84
8.1.150.0050.00220.56
8.1.140.0040.00419.52
8.1.130.0000.00718.82
8.1.120.0050.00317.25
8.1.110.0060.00317.36
8.1.100.0000.00817.42
8.1.90.0070.00017.32
8.1.80.0040.00417.46
8.1.70.0000.00717.41
8.1.60.0000.00817.41
8.1.50.0000.00717.36
8.1.40.0000.00817.47
8.1.30.0000.00717.50
8.1.20.0040.00417.58
8.1.10.0040.00417.48
8.1.00.0000.00817.34
8.0.300.0080.00018.77
8.0.290.0000.00916.75
8.0.280.0030.00618.03
8.0.270.0030.00317.94
8.0.260.0000.00816.75
8.0.250.0070.00017.02
8.0.240.0000.00717.00
8.0.230.0100.00016.96
8.0.220.0070.00016.78
8.0.210.0040.00416.79
8.0.200.0040.00416.90
8.0.190.0030.00616.95
8.0.180.0070.00416.95
8.0.170.0070.00016.83
8.0.160.0070.00016.80
8.0.150.0030.00316.73
8.0.140.0000.00716.94
8.0.130.0000.00613.30
8.0.120.0000.00716.92
8.0.110.0000.00716.97
8.0.100.0050.00316.86
8.0.90.0000.00816.81
8.0.80.0170.00316.93
8.0.70.0040.00316.89
8.0.60.0040.00416.76
8.0.50.0040.00416.86
8.0.30.0100.00917.24
8.0.20.0120.00917.40
8.0.10.0040.00417.04
8.0.00.0120.00616.80
7.4.330.0050.00015.55
7.4.320.0040.00416.51
7.4.300.0030.00316.45
7.4.290.0040.00416.55
7.4.280.0000.00816.46
7.4.270.0000.00716.38
7.4.260.0000.00513.34
7.4.250.0040.00416.43
7.4.240.0090.00016.46
7.4.230.0030.00316.58
7.4.220.0130.01216.54
7.4.210.0070.00816.43
7.4.200.0040.00416.58
7.4.160.0080.00816.54
7.4.150.0150.00317.40
7.4.140.0120.00817.86
7.4.130.0090.00916.43
7.4.120.0120.00816.57
7.4.110.0080.00816.45
7.4.100.0070.01116.61
7.4.90.0100.00716.44
7.4.80.0120.00819.39
7.4.70.0080.00816.55
7.4.60.0180.00416.75
7.4.50.0100.00716.59
7.4.40.0060.01216.42
7.4.30.0130.00916.40
7.4.00.0030.01314.92
7.3.330.0050.00013.39
7.3.320.0060.00013.33
7.3.310.0000.00716.26
7.3.300.0000.00616.27
7.3.290.0050.00216.39
7.3.280.0100.00916.39
7.3.270.0080.00817.40
7.3.260.0110.01316.55
7.3.250.0120.00916.46
7.3.240.0100.00716.53
7.3.230.0110.01116.49
7.3.210.0080.00816.53
7.3.200.0060.00916.68
7.3.190.0080.00816.37
7.3.180.0080.00816.63
7.3.170.0090.00916.69
7.3.160.0090.00616.41
7.3.120.0030.01414.69
7.3.110.0130.00315.05
7.3.100.0060.01214.54
7.3.90.0130.00614.88
7.3.80.0030.01314.84
7.3.70.0130.00314.84
7.3.60.0100.00714.88
7.3.50.0000.01414.88
7.3.40.0060.00914.88
7.3.30.0130.00014.84
7.3.20.0060.01016.39
7.3.10.0050.00716.62
7.3.00.0060.00516.69
7.2.330.0110.00616.64
7.2.320.0070.01016.54
7.2.310.0060.01116.51
7.2.300.0060.01216.51
7.2.290.0030.01316.36
7.2.250.0100.01015.29
7.2.240.0080.01214.88
7.2.230.0080.00815.21
7.2.220.0110.00715.07
7.2.210.0070.00714.96
7.2.200.0070.00715.00
7.2.190.0060.00614.71
7.2.180.0060.00314.85
7.2.170.0090.00914.75
7.2.130.0000.01116.91
7.2.120.0060.00616.92
7.2.110.0090.00316.93
7.2.100.0120.00016.91
7.2.90.0000.01416.92
7.2.80.0030.01016.76
7.2.70.0070.00716.96
7.2.60.0030.00916.66
7.2.50.0030.00916.60
7.2.40.0120.00316.86
7.2.30.0000.01316.82
7.2.20.0080.00817.00
7.2.10.0090.00616.90
7.2.00.0100.00418.01
7.1.330.0030.01015.72
7.1.320.0070.01315.75
7.1.310.0060.00815.47
7.1.300.0070.00715.86
7.1.290.0040.01015.95
7.1.280.0040.01115.65
7.1.270.0040.00415.93
7.1.260.0070.00715.49
7.1.250.0000.00815.79
7.1.100.0070.00718.12
7.1.70.0130.00715.24
7.1.60.0270.00733.38
7.1.50.0200.01333.00
7.1.40.1400.02332.52
7.1.30.1400.01732.72
7.1.20.1430.01332.47
7.1.10.1570.01014.78
7.1.00.1370.00714.89
7.0.200.0000.01715.09
7.0.190.1030.01315.04
7.0.180.1430.01014.50
7.0.170.1300.00014.37
7.0.160.1230.01014.64
7.0.150.0970.01314.37
7.0.140.1570.01014.56
7.0.130.1170.00314.63
7.0.120.1070.01014.74
7.0.110.2300.01014.52
7.0.100.1070.01014.38
7.0.90.1570.01314.39
7.0.80.1630.01714.46
7.0.70.1730.01314.51
7.0.60.1670.01314.13
7.0.50.1600.01014.56
7.0.40.1600.01314.60
7.0.30.0830.01014.53
7.0.20.1530.00714.61
7.0.10.0000.01714.59
7.0.00.0070.00714.65

preferences:
52.12 ms | 400 KiB | 5 Q