3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface SellableItems{ public function addItem(); public function removeItem(); } class tennisBall implements SellableItems{ public static $count=0; public function addItem(){ return self::$count++; } public function removeItem(){ if(self::count>0){ return self::count--; } else { echo "<br/>Sorry, Stock empty"; } } public function ShowData(){ echo "<br/>There are ".self::$count." ".__CLASS__; } } class tv implements SellableItems{ static $count=0; public function addItem(){ return self::count++; } public function removeItem(){ if(self::count>0){ return self::count--; } else { echo "<br/>Sorry, Stock empty"; } } public function ShowData(){ echo "<br/>There are ".self::$count." ".__CLASS__; } } class StoreFactory{ public static function factory($item){ switch($item){ case "tennisBall": $product=new tennisBall(); break; case "tv": $product=new tv(); break; default: die("<br/>WRONG Choice OF PRODUCT: {$item}"); } if($product instanceof SellableItems){ return $product; } else{ die("</br>Sory cannot create particular Product"); } } } $Instance=StoreFactory::factory("tennisBall"); $Instance->addItem(); $Instance->addItem(); $Instance->ShowData();

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)
5.4.310.0040.04012.52
5.4.300.0030.03812.52
5.4.290.0030.03912.51
5.4.280.0020.03812.41
5.4.270.0080.04712.41
5.4.260.0130.04612.41
5.4.250.0070.04312.41
5.4.240.0050.03812.41
5.4.230.0080.05112.40
5.4.220.0110.04612.41
5.4.210.0070.03712.41
5.4.200.0090.04012.41
5.4.190.0070.03912.40
5.4.180.0100.03312.40
5.4.170.0050.03812.41
5.4.160.0060.03612.41
5.4.150.0080.03312.40
5.4.140.0070.03612.09
5.4.130.0060.03512.07
5.4.120.0040.03812.04
5.4.110.0060.03512.04
5.4.100.0040.03812.04
5.4.90.0060.03712.04
5.4.80.0060.03612.03
5.4.70.0100.03112.03
5.4.60.0050.03612.03
5.4.50.0050.03812.03
5.4.40.0040.03712.02
5.4.30.0080.03412.02
5.4.20.0090.03412.01
5.4.10.0050.03512.02
5.4.00.0060.03711.51
5.3.280.0050.03912.71
5.3.270.0060.03812.72
5.3.260.0050.04012.72
5.3.250.0030.04012.72
5.3.240.0050.03812.71
5.3.230.0080.03512.71
5.3.220.0090.04912.68
5.3.210.0120.04412.68
5.3.200.0090.04612.68
5.3.190.0110.04412.68
5.3.180.0060.03712.67
5.3.170.0050.03712.67
5.3.160.0030.04012.68
5.3.150.0060.03812.67
5.3.140.0140.04012.66
5.3.130.0100.04912.66
5.3.120.0070.05112.66
5.3.110.0060.04012.66
5.3.100.0070.03712.13
5.3.90.0050.03812.11
5.3.80.0060.03712.10
5.3.70.0080.03412.10
5.3.60.0040.03812.09
5.3.50.0090.03312.04
5.3.40.0120.03212.03
5.3.30.0060.03511.99
5.3.20.0070.03511.77
5.3.10.0050.03611.73
5.3.00.0080.03511.73
5.2.170.0060.0289.23
5.2.160.0080.0269.23
5.2.150.0020.0329.23
5.2.140.0060.0329.23
5.2.130.0050.0299.19
5.2.120.0090.0249.19
5.2.110.0060.0339.19
5.2.100.0030.0379.19
5.2.90.0030.0319.18
5.2.80.0080.0279.18
5.2.70.0040.0309.18
5.2.60.0050.0359.14
5.2.50.0050.0329.11
5.2.40.0040.0309.09
5.2.30.0060.0329.05
5.2.20.0040.0309.04
5.2.10.0060.0278.95
5.2.00.0030.0318.82
5.1.60.0040.0248.10
5.1.50.0040.0258.10
5.1.40.0050.0248.07
5.1.30.0040.0268.42
5.1.20.0050.0298.45
5.1.10.0060.0248.17
5.1.00.0040.0328.17
5.0.50.0040.0196.65
5.0.40.0060.0256.51
5.0.30.0060.0366.32
5.0.20.0070.0216.29
5.0.10.0040.0226.27
5.0.00.0010.0376.26
4.4.90.0020.0234.78
4.4.80.0040.0164.75
4.4.70.0060.0204.75
4.4.60.0040.0204.75
4.4.50.0060.0144.77
4.4.40.0030.0324.71
4.4.30.0020.0184.76
4.4.20.0050.0164.84
4.4.10.0020.0184.85
4.4.00.0050.0234.76
4.3.110.0030.0164.66
4.3.100.0020.0154.66
4.3.90.0030.0154.63
4.3.80.0050.0234.59
4.3.70.0050.0124.63
4.3.60.0050.0184.63
4.3.50.0040.0164.63
4.3.40.0050.0294.54
4.3.30.0020.0203.29
4.3.20.0020.0163.26
4.3.10.0020.0153.22
4.3.00.0070.0177.13

preferences:
142 ms | 1394 KiB | 7 Q