3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Stack { public $maxSize; public $items = []; public $top = 0; public function __construct(array $stack, $maxSize){ $this->items = $stack; $this->maxSize = $maxSize; } public function push($item){ if ($this->top === $this->maxSize){ throw new Exception("Stack overflow"); } $this->items[$this->top] = $item; $this->top++; } public function pop(){ if ($this->top === 0){ throw new Exception("Stack underflow"); } $this->top--; return $this->items[$this->top]; } } $items = [1, 2, 3, 4, 5]; $maxSize = 10; $stack = new Stack($items, $maxSize); $stack->push(6); var_dump($stack); $stack->pop(); var_dump($stack);

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.4.140.0130.00817.54
8.4.130.0070.00922.18
8.4.120.0150.00622.38
8.4.110.0100.00922.32
8.4.100.0100.01018.85
8.4.90.0140.00418.92
8.4.80.0100.01018.80
8.4.70.0040.00417.88
8.4.60.0110.00818.66
8.4.50.0090.01118.76
8.4.40.0110.00719.63
8.4.30.0120.00819.59
8.4.20.0100.01019.57
8.4.10.0000.00917.66
8.3.260.0140.00716.45
8.3.250.0100.00918.80
8.3.240.0110.00717.20
8.3.230.0140.00516.66
8.3.220.0090.01018.82
8.3.210.0110.00918.52
8.3.200.0030.00616.55
8.3.190.0070.00317.16
8.3.180.0080.00717.41
8.3.170.0040.01120.69
8.3.160.0130.00617.13
8.3.150.0070.01117.04
8.3.140.0000.01516.80
8.3.130.0130.00716.62
8.3.120.0060.00320.62
8.3.110.0030.00620.94
8.3.100.0040.00424.06
8.3.90.0080.00026.77
8.3.80.0090.00018.30
8.3.70.0090.00616.49
8.3.60.0070.01518.33
8.3.50.0140.00318.23
8.3.40.0070.00718.76
8.3.30.0120.00318.68
8.3.20.0000.00721.87
8.3.10.0050.00323.53
8.3.00.0000.00823.52
8.2.290.0130.00620.38
8.2.280.0090.00918.59
8.2.270.0070.01117.21
8.2.260.0070.01116.37
8.2.250.0130.00318.17
8.2.240.0130.00617.07
8.2.230.0040.00422.58
8.2.220.0000.01037.54
8.2.210.0070.01326.77
8.2.200.0030.00616.75
8.2.190.0200.00016.58
8.2.180.0040.01118.12
8.2.170.0110.00722.96
8.2.160.0100.00320.00
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0040.00421.04
8.2.120.0040.00426.35
8.2.110.0100.01019.27
8.2.100.0070.00717.71
8.2.90.0040.00420.01
8.2.80.0030.00517.97
8.2.70.0100.00017.93
8.2.60.0000.00818.03
8.2.50.0040.00418.10
8.2.40.0000.00819.18
8.2.30.0000.00820.94
8.2.20.0070.00017.95
8.2.10.0030.00518.10
8.2.00.0030.00619.13
8.1.330.0120.00821.85
8.1.320.0110.00816.12
8.1.310.0000.00916.52
8.1.300.0070.00718.63
8.1.290.0090.00030.84
8.1.280.0120.00325.92
8.1.270.0060.00323.97
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0060.01222.18
8.1.230.0040.00722.77
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0080.00317.23
8.1.190.0000.00817.13
8.1.180.0000.00818.10
8.1.170.0050.00518.49
8.1.160.0000.00818.84
8.1.150.0000.00719.03
8.1.140.0000.00717.50
8.1.130.0080.00318.92
8.1.120.0070.00017.48
8.1.110.0000.00717.23
8.1.100.0000.00817.38
8.1.90.0070.00017.27
8.1.80.0020.00517.28
8.1.70.0040.00417.43
8.1.60.0050.00517.60
8.1.50.0080.00017.43
8.1.40.0030.00617.54
8.1.30.0000.00817.69
8.1.20.0080.00017.55
8.1.10.0090.00017.48
8.1.00.0050.00317.53
8.0.300.0070.00019.98
8.0.290.0000.00816.63
8.0.280.0000.00818.26
8.0.270.0040.00417.13
8.0.260.0030.00517.13
8.0.250.0030.00316.95
8.0.240.0040.00416.93
8.0.230.0000.00716.88
8.0.220.0080.00016.84
8.0.210.0070.00016.85
8.0.200.0000.00716.77
8.0.190.0040.00416.79
8.0.180.0000.00816.75
8.0.170.0040.00416.85
8.0.160.0040.00316.77
8.0.150.0000.00716.73
8.0.140.0040.00416.84
8.0.130.0030.00313.16
8.0.120.0060.00316.70
8.0.110.0040.00416.94
8.0.100.0080.00016.81
8.0.90.0000.00716.71
8.0.80.0070.00716.84
8.0.70.0040.00416.89
8.0.60.0040.00416.83
8.0.50.0000.00816.89
8.0.30.0070.01217.12
8.0.20.0140.00517.40
8.0.10.0080.00016.85
8.0.00.0120.00916.82
7.4.330.0050.00016.84
7.4.320.0000.00616.67
7.4.300.0070.00016.54
7.4.290.0030.00516.44
7.4.280.0030.00616.63
7.4.270.0060.00316.63
7.4.260.0070.00016.41
7.4.250.0040.00416.53
7.4.240.0060.00316.63
7.4.230.0030.00316.69
7.4.220.0030.00516.52
7.4.210.0090.00916.63
7.4.200.0030.00316.66
7.4.160.0110.01016.42
7.4.140.0100.01017.86
7.4.130.0130.00416.43
7.4.120.0110.01016.45
7.4.110.0070.01016.66
7.4.100.0120.00416.68
7.4.90.0100.00716.45
7.4.80.0080.01619.39
7.4.70.0080.00816.54
7.4.60.0110.00616.52
7.4.50.0000.01416.46
7.4.40.0070.01016.48
7.4.00.0070.01014.72
7.3.330.0030.00313.24
7.3.320.0030.00313.25
7.3.310.0040.00416.25
7.3.300.0070.00016.29
7.3.290.0000.00716.39
7.3.280.0090.00816.33
7.3.260.0130.00516.38
7.3.240.0090.01016.47
7.3.230.0170.00016.51
7.3.210.0070.01016.53
7.3.200.0130.00416.40
7.3.190.0100.01016.57
7.3.180.0080.01216.67
7.3.170.0100.00716.50
7.3.160.0070.01116.37
7.3.120.0080.00814.79
7.3.110.0070.00914.80
7.3.100.0050.01314.80
7.3.90.0080.01014.94
7.3.80.0020.01014.96
7.3.70.0080.00214.98
7.3.60.0050.00914.75
7.3.50.0060.01014.76
7.3.40.0100.00314.98
7.3.30.0070.00814.63
7.3.20.0070.00316.57
7.3.10.0060.00716.55
7.3.00.0040.00916.46
7.2.330.0060.01316.33
7.2.320.0070.01016.39
7.2.310.0150.00616.66
7.2.300.0070.01316.64
7.2.290.0120.00616.43
7.2.250.0100.01015.23
7.2.240.0070.00714.86
7.2.230.0110.00714.99
7.2.220.0080.00715.13
7.2.210.0050.00915.06
7.2.200.0070.01014.91
7.2.190.0060.01114.88
7.2.180.0050.01015.00
7.2.170.0050.01315.02
7.2.160.0070.01014.82
7.2.150.0070.01017.01
7.2.140.0060.01216.90
7.2.130.0070.00916.86
7.2.120.0030.01216.67
7.2.110.0100.00816.67
7.2.100.0090.00816.82
7.2.90.0090.00716.82
7.2.80.0050.00916.79
7.2.70.0110.00816.71
7.2.60.0110.00516.72
7.2.50.0090.00616.77
7.2.40.0500.00917.03
7.2.30.0180.00617.14
7.2.20.0280.00717.22
7.2.10.0180.00816.89
7.2.00.0500.00917.17
7.1.330.0050.00815.98
7.1.320.0040.01115.73
7.1.310.0040.01116.05
7.1.300.0030.00915.79
7.1.290.0030.01115.66
7.1.280.0060.00715.70
7.1.270.0050.00815.84
7.1.260.0010.01115.81
7.1.250.0070.00915.70
7.1.200.0040.00815.79
7.1.160.1420.00716.80
7.1.150.0710.01016.86
7.1.140.0740.01117.05
7.1.130.0440.01116.99
7.1.120.2280.00816.84
7.1.110.1730.01016.20
7.1.100.2090.00816.02
7.1.90.1160.00916.37
7.1.80.2280.00816.18
7.1.70.2060.00915.11
7.1.60.2120.00933.43
7.1.50.1670.00833.16
7.1.40.1720.01432.39
7.1.30.3190.01432.74
7.1.20.1790.01332.73
7.1.10.2130.01214.66
7.1.00.2460.00615.03

preferences:
151.35 ms | 403 KiB | 5 Q