3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace StockExample; interface Order { public function execute(); } class StockBuy { public function __invoke() { echo "You want to buy stocks via __invoke()" . PHP_EOL; } } class StockSell { public function __invoke() { echo "You want to sell stocks __invoke()" . PHP_EOL; } } class MyCommand implements Order { private $action; public function __construct(callable $action) { $this->action = $action; } public function execute() { // Option 1) use call_user_function call_user_func($this->action); // Option 2) define it as a variable and call it by adding `()` //$action = $this->action; //$action(); } } // example with a callable object $bsc = new MyCommand(new StockBuy()); $ssc = new MyCommand(new StockSell()); $bsc->execute(); $ssc->execute();

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.0090.01019.07
8.5.00.0150.01020.13
8.4.150.0020.00014.05
8.4.140.0160.01217.55
8.4.130.0090.01117.64
8.4.120.0140.00620.34
8.4.110.0150.00522.26
8.4.100.0130.00817.89
8.4.90.0080.00418.91
8.4.80.0090.01117.66
8.4.70.0060.00317.91
8.4.60.0140.00618.96
8.4.50.0110.01019.71
8.4.40.0100.01018.69
8.4.30.0160.00320.48
8.4.20.0130.00719.52
8.4.10.0060.00319.63
8.3.280.0090.01118.43
8.3.270.0090.01016.41
8.3.260.0080.00516.54
8.3.250.0120.00719.22
8.3.240.0140.00517.31
8.3.230.0050.00316.61
8.3.220.0060.00217.28
8.3.210.0050.00416.73
8.3.200.0060.00316.77
8.3.190.0110.00816.98
8.3.180.0090.00616.49
8.3.170.0000.01317.27
8.3.160.0140.00418.38
8.3.150.0120.00617.29
8.3.140.0040.00416.61
8.3.130.0000.00916.79
8.3.120.0060.00320.53
8.3.110.0080.00018.23
8.3.100.0040.00416.63
8.3.90.0050.00316.66
8.3.80.0000.00918.68
8.3.70.0120.00318.18
8.3.60.0150.00418.56
8.3.50.0110.00624.55
8.3.40.0070.00720.25
8.3.30.0230.00018.67
8.3.20.0040.00421.02
8.3.10.0000.00820.21
8.3.00.0040.00422.45
8.2.290.0080.00120.75
8.2.280.0100.00820.07
8.2.270.0110.00717.46
8.2.260.0070.01018.88
8.2.250.0080.00016.81
8.2.240.0090.00917.29
8.2.230.0040.00720.94
8.2.220.0080.00024.06
8.2.210.0100.00726.77
8.2.200.0030.00616.63
8.2.190.0150.00016.58
8.2.180.0150.00318.16
8.2.170.0120.00322.96
8.2.160.0100.00321.14
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0000.00826.16
8.2.120.0050.00326.16
8.2.110.0060.00320.52
8.2.100.0080.00417.91
8.2.90.0080.00019.26
8.2.80.0000.00817.97
8.2.70.0050.00317.50
8.2.60.0040.00417.93
8.2.50.0040.00418.07
8.2.40.0000.00818.21
8.2.30.0000.00818.07
8.2.20.0000.00718.08
8.2.10.0000.00719.34
8.2.00.0050.00219.31
8.1.330.0120.00821.80
8.1.320.0100.01016.50
8.1.310.0110.00716.65
8.1.300.0030.00516.22
8.1.290.0030.00618.88
8.1.280.0110.00325.92
8.1.270.0050.00320.78
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0070.00323.96
8.1.230.0040.00823.98
8.1.220.0040.00418.77
8.1.210.0040.00420.85
8.1.200.0030.00617.36
8.1.190.0060.00317.52
8.1.180.0050.00318.10
8.1.170.0040.00418.72
8.1.160.0070.00018.94
8.1.150.0050.00318.93
8.1.140.0040.00418.78
8.1.130.0040.00421.98
8.1.120.0070.00017.44
8.1.110.0040.00417.47
8.1.100.0080.00017.35
8.1.90.0040.00417.46
8.1.80.0040.00417.43
8.1.70.0060.00317.47
8.1.60.0000.00817.59
8.1.50.0030.00517.56
8.1.40.0080.00017.42
8.1.30.0060.00317.64
8.1.20.0000.00817.68
8.1.10.0030.00717.48
8.1.00.0030.00517.48
8.0.300.0070.00019.85
8.0.290.0070.00017.18
8.0.280.0040.00418.44
8.0.270.0000.00718.13
8.0.260.0030.00320.00
8.0.250.0040.00417.01
8.0.240.0030.00317.00
8.0.230.0040.00417.07
8.0.220.0050.00317.02
8.0.210.0070.00016.94
8.0.200.0000.00617.06
8.0.190.0000.00816.91
8.0.180.0020.00516.99
8.0.170.0000.00816.88
8.0.160.0000.00716.97
8.0.150.0040.00416.83
8.0.140.0080.00016.81
8.0.130.0030.00313.36
8.0.120.0050.00216.86
8.0.110.0070.00016.84
8.0.100.0040.00417.01
8.0.90.0030.00616.88
8.0.80.0140.00316.96
8.0.70.0040.00416.95
8.0.60.0070.00016.76
8.0.50.0000.00816.88
8.0.30.0120.00617.21
8.0.20.0120.00717.20
8.0.10.0000.00917.09
8.0.00.0140.00416.71
7.4.330.0020.00215.55
7.4.320.0070.00016.48
7.4.300.0020.00516.41
7.4.290.0030.00316.30
7.4.280.0030.00516.46
7.4.270.0030.00316.41
7.4.260.0030.00313.28
7.4.250.0050.00316.33
7.4.240.0020.00516.61
7.4.230.0000.00716.31
7.4.220.0050.00216.65
7.4.210.0070.00916.53
7.4.200.0030.00316.63
7.4.130.0140.00516.41
7.4.120.0110.00716.50
7.4.110.0120.00416.48
7.4.100.0070.01016.64
7.4.90.0110.00716.62
7.4.80.0100.01019.39
7.4.70.0080.00816.54
7.4.60.0110.01116.38
7.4.50.0070.01116.58
7.4.40.0100.00716.25
7.4.30.0130.00516.50
7.4.20.0070.01116.46
7.4.10.0030.01616.50
7.4.00.0080.01116.55
7.3.330.0030.00316.26
7.3.320.0030.00313.29
7.3.310.0000.00716.29
7.3.300.0060.00016.32
7.3.290.0050.01116.30
7.3.280.0120.00916.31
7.3.260.0130.00616.34
7.3.230.0060.01016.49
7.3.210.0060.01016.38
7.3.200.0160.00316.38
7.3.190.0120.00616.29
7.3.180.0130.00316.22
7.3.170.0070.01016.34
7.3.160.0120.01116.39
7.3.150.0100.00616.10
7.3.140.0090.00616.27
7.3.130.0060.00916.35
7.3.120.0070.00816.24
7.3.110.0100.00616.36
7.3.100.0070.01116.57
7.3.90.0000.01416.32
7.3.80.0160.00016.39
7.3.70.0110.00816.39
7.3.60.0060.01216.26
7.3.50.0030.01516.23
7.3.40.0140.00616.45
7.3.30.0120.00416.27
7.3.20.0100.00616.37
7.3.10.0100.01016.16
7.3.00.0170.00316.29
7.2.330.0090.00916.70
7.2.320.0180.00316.42
7.2.310.0070.01016.81
7.2.300.0100.00716.67
7.2.290.0090.00916.80
7.2.280.0090.00616.45
7.2.270.0060.01316.55
7.2.260.0070.01016.73
7.2.250.0060.01016.75
7.2.240.0130.00316.74
7.2.230.0060.01016.69
7.2.220.0080.00816.88
7.2.210.0090.00916.90
7.2.200.0070.01316.58
7.2.190.0100.01316.75
7.2.180.0120.01316.73
7.2.170.0060.01016.64
7.2.160.0060.00916.61
7.2.150.0110.01116.66
7.2.140.0040.01416.75
7.2.130.0100.01016.84
7.2.120.0130.00616.67
7.2.110.0060.00916.75
7.2.100.0050.01416.76
7.2.90.0070.01316.67
7.2.80.0080.00816.40
7.2.70.0070.01316.79
7.2.60.0060.01216.79
7.2.50.0000.01716.67
7.2.40.0090.01216.68
7.2.30.0040.01516.69
7.2.20.0090.00916.67
7.2.10.0150.00316.74
7.2.00.0090.01316.86

preferences:
172.36 ms | 403 KiB | 5 Q