3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace StockCommandNS; //Command interface interface Order { public function execute(); } //Receiver class class StockTrade { public function buy() { print("You want to buy stocks\n"); } public function sell() { print("You want to sell stocks\n"); } } //Invoker class class Agent { public function placeOrder(Order $order) { $order->execute($order); } } //ConcreteCommand Class class GenericOrder implements Order { private $action; public function __construct($action) { $this->action = $action; } public function execute() { call_user_func($this->action); } } $stock = new StockTrade(); $bsc = new GenericOrder([$stock, 'buy']); $ssc = new GenericOrder([$stock, 'sell']); $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.5.10.0110.00619.01
8.5.00.0100.01120.04
8.4.150.0010.00114.05
8.4.140.0140.00817.70
8.4.130.0150.00618.57
8.4.120.0140.00624.24
8.4.110.0090.00419.02
8.4.100.0150.00518.83
8.4.90.0100.01120.93
8.4.80.0110.00618.95
8.4.70.0090.01018.92
8.4.60.0120.00918.74
8.4.50.0070.00819.08
8.4.40.0200.00717.68
8.4.30.0100.01018.73
8.4.20.0140.00719.59
8.4.10.0130.00719.25
8.3.280.0140.00720.18
8.3.270.0120.00916.69
8.3.260.0130.00616.61
8.3.250.0100.00918.92
8.3.240.0060.00217.25
8.3.230.0120.00516.61
8.3.220.0040.00318.82
8.3.210.0120.00718.37
8.3.200.0060.00316.84
8.3.190.0100.00617.02
8.3.180.0130.00616.76
8.3.170.0180.00016.54
8.3.160.0000.00816.86
8.3.150.0130.00317.36
8.3.140.0120.00616.66
8.3.130.0000.01018.55
8.3.120.0070.01019.00
8.3.110.0100.00618.31
8.3.100.0060.00324.06
8.3.90.0080.00026.77
8.3.80.0040.00416.63
8.3.70.0060.01218.18
8.3.60.0060.00918.30
8.3.50.0120.00824.40
8.3.40.0070.01020.34
8.3.30.0140.00418.70
8.3.20.0090.00020.77
8.3.10.0060.00320.16
8.3.00.0000.00822.51
8.2.290.0080.01120.59
8.2.280.0050.00520.36
8.2.270.0160.00317.06
8.2.260.0070.01118.55
8.2.250.0040.00416.99
8.2.240.0000.00917.16
8.2.230.0120.00020.94
8.2.220.0120.00637.54
8.2.210.0070.01326.77
8.2.200.0040.00416.63
8.2.190.0090.01216.63
8.2.180.0140.00416.32
8.2.170.0100.00722.96
8.2.160.0080.00621.09
8.2.150.0040.00424.18
8.2.140.0000.00724.66
8.2.130.0040.00426.16
8.2.120.0070.00026.16
8.2.110.0030.00622.21
8.2.100.0120.00017.91
8.2.90.0000.00917.63
8.2.80.0000.00818.82
8.2.70.0060.00317.93
8.2.60.0100.00018.09
8.2.50.0100.00019.21
8.2.40.0000.00821.04
8.2.30.0040.00419.26
8.2.20.0000.00717.95
8.2.10.0030.00519.26
8.2.00.0000.00719.13
8.1.330.0130.00521.79
8.1.320.0060.00317.78
8.1.310.0050.00517.82
8.1.300.0000.00820.40
8.1.290.0060.00318.88
8.1.280.0130.00625.92
8.1.270.0060.00322.20
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00623.92
8.1.230.0110.00020.98
8.1.220.0040.00417.74
8.1.210.0030.00518.77
8.1.200.0090.00017.38
8.1.190.0040.00417.22
8.1.180.0070.00018.97
8.1.170.0060.00318.61
8.1.160.0080.00019.02
8.1.150.0040.00418.82
8.1.140.0000.00718.96
8.1.130.0000.00717.39
8.1.120.0040.00417.52
8.1.110.0040.00417.35
8.1.100.0000.00717.51
8.1.90.0000.00717.48
8.1.80.0040.00417.48
8.1.70.0030.00317.41
8.1.60.0060.00317.52
8.1.50.0000.00717.52
8.1.40.0090.00017.43
8.1.30.0060.00317.68
8.1.20.0040.00417.66
8.1.10.0040.00417.60
8.1.00.0080.00017.55
8.0.300.0030.00518.77
8.0.290.0040.00416.75
8.0.280.0040.00418.45
8.0.270.0070.00016.93
8.0.260.0030.00316.89
8.0.250.0030.00316.93
8.0.240.0040.00417.04
8.0.230.0000.00717.05
8.0.220.0000.00717.02
8.0.210.0040.00417.01
8.0.200.0000.00717.09
8.0.190.0030.00616.90
8.0.180.0060.00316.88
8.0.170.0060.00617.00
8.0.160.0070.00016.95
8.0.150.0040.00416.91
8.0.140.0000.00716.83
8.0.130.0050.00013.39
8.0.120.0030.00516.90
8.0.110.0000.00716.80
8.0.100.0000.00717.03
8.0.90.0080.00017.02
8.0.80.0020.01316.92
8.0.70.0080.00016.98
8.0.60.0030.00517.00
8.0.50.0030.00516.91
8.0.30.0070.01016.97
8.0.20.0140.00917.10
8.0.10.0000.00717.02
8.0.00.0160.00316.70
7.4.330.0000.00615.55
7.4.320.0030.00316.63
7.4.300.0000.00616.63
7.4.290.0000.00816.43
7.4.280.0000.01116.58
7.4.270.0040.00416.54
7.4.260.0030.00313.31
7.4.250.0070.00016.57
7.4.240.0050.00216.61
7.4.230.0040.00416.59
7.4.220.0030.00316.48
7.4.210.0050.01116.57
7.4.200.0000.00816.64
7.4.130.0140.00916.61
7.4.120.0100.00716.41
7.4.110.0150.00316.49
7.4.100.0100.01016.56
7.4.90.0100.00716.42
7.4.80.0060.01419.39
7.4.70.0100.00616.48
7.4.60.0170.00316.42
7.4.50.0000.01316.41
7.4.40.0090.00616.39
7.4.30.0130.01016.55
7.4.20.0100.00616.57
7.4.10.0040.01216.58
7.4.00.0130.01016.75
7.3.330.0040.00416.36
7.3.320.0020.00213.27
7.3.310.0030.00316.35
7.3.300.0030.00316.24
7.3.290.0100.00916.31
7.3.280.0090.00916.34
7.3.260.0110.00916.55
7.3.240.0130.00616.55
7.3.230.0060.01316.36
7.3.210.0070.01016.27
7.3.200.0030.01316.32
7.3.190.0100.00716.39
7.3.180.0090.00916.48
7.3.170.0090.00616.32
7.3.160.0120.00616.39
7.3.150.0100.00716.39
7.3.140.0160.00016.36
7.3.130.0130.00316.46
7.3.120.0140.00816.39
7.3.110.0160.00016.28
7.3.100.0110.01116.29
7.3.90.0120.01516.51
7.3.80.0160.00016.46
7.3.70.0070.01016.25
7.3.60.0070.01016.29
7.3.50.0130.00316.24
7.3.40.0070.01016.26
7.3.30.0120.01216.27
7.3.20.0100.00616.56
7.3.10.0080.00816.38
7.3.00.0000.01616.34
7.2.330.0140.00716.86
7.2.320.0080.00816.55
7.2.310.0040.01516.70
7.2.300.0040.01516.39
7.2.290.0160.00616.83
7.2.280.0030.01416.51
7.2.270.0060.01016.64
7.2.260.0120.01216.72
7.2.250.0060.01616.86
7.2.240.0080.00916.59
7.2.230.0120.01216.70
7.2.220.0110.01116.61
7.2.210.0120.00616.59
7.2.200.0100.00716.59
7.2.190.0170.00716.74
7.2.180.0090.00916.53
7.2.170.0090.00916.65
7.2.160.0080.00816.69
7.2.150.0090.00916.77
7.2.140.0070.01016.56
7.2.130.0280.00616.74
7.2.120.0030.01316.75
7.2.110.0090.00916.84
7.2.100.0070.01016.84
7.2.90.0090.00916.55
7.2.80.0110.00616.44
7.2.70.0110.00816.64
7.2.60.0150.00916.74
7.2.50.0160.00916.77
7.2.40.0110.00916.55
7.2.30.0100.00716.81
7.2.20.0110.01416.54
7.2.10.0220.01616.67
7.2.00.0060.01716.73

preferences:
33.77 ms | 403 KiB | 5 Q