3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace StockCommandNS; interface Order { public function execute(); } // Receiver class. class StockTrade { public function buy() { print("You want to buy stocks"); } public function sell() { print("You want to sell stocks "); } } // Invoker. class Agent { private \SplQueue $ordersQueue; public function __construct() { $this->ordersQueue = new \SplQueue(); } public function placeOrder(Order $order) { $this->ordersQueue->push($order); $order->execute($this->ordersQueue->shift()); } } //ConcreteCommand Class. class BuyStockOrder implements Order { private StockTrade $stock; public function __construct(StockTrade $st) { $this->stock = $st; } public function execute() { $this->stock->buy(); } } //ConcreteCommand Class. class SellStockOrder implements Order { private StockTrade $stock; public function __construct(StockTrade $st) { $this->stock = $st; } public function execute() { $this->stock->sell(); } } class MyCommand implements Order { private $action; public function __construct($action) { $this->action = $action; } public function execute() { $this->action->run(); } } $stock = new StockTrade(); $bsc = new BuyStockOrder($stock); $ssc = new SellStockOrder($stock); $agent = new Agent(); $agent->placeOrder($bsc); // Buy Shares $agent->placeOrder($ssc); // Sell Shares

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.0090.01218.43
8.3.50.0090.00618.30
8.3.40.0110.00722.11
8.3.30.0040.01118.71
8.3.20.0000.00820.89
8.3.10.0050.00320.34
8.3.00.0060.00322.52
8.2.180.0090.01218.41
8.2.170.0060.01222.96
8.2.160.0130.00019.44
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0080.00026.16
8.2.120.0040.00421.06
8.2.110.0050.00520.54
8.2.100.0090.00617.66
8.2.90.0060.00317.63
8.2.80.0060.00318.71
8.2.70.0000.00817.75
8.2.60.0040.00418.04
8.2.50.0040.00418.05
8.2.40.0000.00818.09
8.2.30.0040.00419.45
8.2.20.0040.00418.20
8.2.10.0000.00719.20
8.2.00.0040.00419.36
8.1.280.0140.00025.92
8.1.270.0000.00820.76
8.1.260.0030.00626.35
8.1.250.0060.00328.09
8.1.240.0040.00420.95
8.1.230.0040.00717.77
8.1.220.0030.00517.79
8.1.210.0030.00518.77
8.1.200.0030.00617.35
8.1.190.0030.00617.23
8.1.180.0060.00318.10
8.1.170.0040.00417.62
8.1.160.0000.00820.71
8.1.150.0040.00418.91
8.1.140.0050.00520.72
8.1.130.0040.00421.98
8.1.120.0070.00017.55
8.1.110.0080.00017.36
8.1.100.0000.00717.40
8.1.90.0040.00417.51
8.1.80.0030.00517.31
8.1.70.0000.00717.45
8.1.60.0030.00617.63
8.1.50.0000.00817.52
8.1.40.0000.00817.53
8.1.30.0060.00317.70
8.1.20.0050.00317.72
8.1.10.0020.00517.50
8.1.00.0080.00017.43
8.0.300.0040.00418.84
8.0.290.0050.00316.63
8.0.280.0000.00718.52
8.0.270.0050.00317.97
8.0.260.0060.00020.03
8.0.250.0030.00317.05
8.0.240.0030.00317.07
8.0.230.0000.00716.96
8.0.220.0040.00417.04
8.0.210.0040.00416.97
8.0.200.0040.00417.01
8.0.190.0000.00717.08
8.0.180.0020.00516.98
8.0.170.0000.00917.01
8.0.160.0040.00416.96
8.0.150.0040.00416.84
8.0.140.0030.00616.86
8.0.130.0030.00313.39
8.0.120.0030.00316.97
8.0.110.0000.00717.03
8.0.100.0000.00816.88
8.0.90.0040.00317.05
8.0.80.0080.00716.92
8.0.70.0040.00416.94
8.0.60.0070.00017.00
8.0.50.0000.00716.96
8.0.30.0100.00617.20
8.0.20.0120.01117.07
8.0.10.0030.00417.06
8.0.00.0030.01617.04
7.4.330.0050.00015.55
7.4.320.0040.00416.55
7.4.300.0060.00016.55
7.4.290.0000.00716.41
7.4.280.0060.00316.52
7.4.270.0000.00716.46
7.4.260.0050.00316.58
7.4.250.0050.00316.59
7.4.240.0040.00416.52
7.4.230.0000.00716.73
7.4.220.0040.00416.74
7.4.210.0070.00816.67
7.4.200.0030.00316.53
7.4.130.0120.00916.53
7.4.120.0150.00916.66
7.4.110.0060.01216.53
7.4.100.0100.00716.69
7.4.90.0140.00316.46
7.4.80.0060.01319.39
7.4.70.0130.00316.39
7.4.60.0090.00816.44
7.4.50.0060.00916.48
7.4.40.0000.01716.45
7.4.30.0090.00616.16
7.4.20.0160.00616.57
7.4.10.0070.01516.75
7.4.00.0040.01116.43
7.3.330.0020.00515.95
7.3.320.0000.00512.96
7.3.310.0080.00016.13
7.3.300.0070.00016.16
7.3.290.0070.00816.20
7.3.280.0030.01016.11
7.3.260.0140.00616.25
7.3.240.0110.00716.25
7.3.230.0120.00916.26
7.3.210.0110.00516.34
7.3.200.0070.01016.37
7.3.190.0030.01416.38
7.3.180.0090.01216.29
7.3.170.0090.00916.45
7.3.160.0080.01116.28
7.3.150.0080.00516.30
7.3.140.0070.01416.05
7.3.130.0070.01416.06
7.3.120.0070.01016.26
7.3.110.0120.00316.29
7.3.100.0060.00816.19
7.3.90.0100.00716.12
7.3.80.0100.00616.04
7.3.70.0100.00316.13
7.3.60.0030.01016.23
7.3.50.0060.01016.13
7.3.40.0110.00616.14
7.3.30.0070.00716.13
7.3.20.0090.00616.26
7.3.10.0110.00416.21
7.3.00.0150.00016.08
7.2.330.0130.01016.08
7.2.320.0060.01016.16
7.2.310.0080.01116.52
7.2.300.0100.01316.51
7.2.290.0120.00616.36
7.2.280.0090.00616.13
7.2.270.0110.01116.36
7.2.260.0080.00816.18
7.2.250.0000.01516.14
7.2.240.0150.00016.32
7.2.230.0110.00716.43
7.2.220.0000.01516.05
7.2.210.0090.00616.22
7.2.200.0000.01416.39
7.2.190.0000.01416.13
7.2.180.0100.00616.25
7.2.170.0100.00416.25
7.2.160.0040.01116.36
7.2.150.0040.01116.28
7.2.140.0110.00416.32
7.2.130.0030.01216.38
7.2.120.0100.00716.32
7.2.110.0080.01316.32
7.2.100.0170.01416.23
7.2.90.0130.00416.15
7.2.80.0170.00716.47
7.2.70.0040.01216.39
7.2.60.0100.01016.30
7.2.50.0200.00316.40
7.2.40.0100.01316.32
7.2.30.0070.01016.43
7.2.20.0150.00316.50
7.2.10.0090.00916.22
7.2.00.0090.00916.13

preferences:
66.4 ms | 400 KiB | 5 Q