3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Move { var $direction; var $value; var $x; var $y; public static function initializeEmpty(){ return (new Move(array(0, 0), "NONE", -2)); } public function __construct($pos, $direction, $value){ $this->y = $pos[0]; $this->x = $pos[1]; $this->value = $value; $this->direction = $direction; } public function compare($move){ return $move->value > $this->value ? $move->value : $this->value; } public static function maxValDirection($moves){ $best = Move::initializeEmpty(); foreach($moves as $m){ $best = $move->compare($best); } return $best; } } $m1 = Move::initializeEmpty(); $m2 = new Move(array(0, 1), "RIGHT", 10); print_r(Move::maxValDirection(array($m1, $m2))); ?>

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.0070.01416.84
8.3.50.0110.00418.30
8.3.40.0080.00818.96
8.3.30.0110.00418.76
8.3.20.0060.00320.21
8.3.10.0040.00423.71
8.3.00.0080.00019.38
8.2.180.0170.00716.50
8.2.170.0110.00422.96
8.2.160.0100.00320.39
8.2.150.0080.00024.18
8.2.140.0030.00524.66
8.2.130.0090.00020.44
8.2.120.0080.00026.35
8.2.110.0090.00020.99
8.2.100.0040.00818.03
8.2.90.0000.00819.21
8.2.80.0030.00517.97
8.2.70.0030.00517.61
8.2.60.0140.00517.66
8.2.50.0000.00818.07
8.2.40.0000.00818.35
8.2.30.0000.00718.05
8.2.20.0060.00317.70
8.2.10.0000.00818.17
8.2.00.0030.00618.12
8.1.280.0090.00925.92
8.1.270.0040.00423.96
8.1.260.0040.00428.09
8.1.250.0000.00828.09
8.1.240.0070.00317.79
8.1.230.0070.00418.80
8.1.220.0030.00517.80
8.1.210.0040.00418.77
8.1.200.0000.00917.48
8.1.190.0060.00317.36
8.1.180.0040.00418.10
8.1.170.0090.00018.39
8.1.160.0000.00718.93
8.1.150.0000.00718.89
8.1.140.0050.00319.64
8.1.130.0000.00717.71
8.1.120.0000.00817.47
8.1.110.0050.00217.52
8.1.100.0090.00017.36
8.1.90.0070.00017.46
8.1.80.0000.00717.35
8.1.70.0040.00417.34
8.1.60.0090.00317.54
8.1.50.0050.00317.56
8.1.40.0000.00817.48
8.1.30.0050.00317.60
8.1.20.0070.00017.54
8.1.10.0080.00017.59
8.1.00.0040.00417.56
8.0.300.0000.00718.77
8.0.290.0030.00616.75
8.0.280.0000.00818.43
8.0.270.0000.00717.30
8.0.260.0050.00317.18
8.0.250.0070.00016.95
8.0.240.0070.00016.93
8.0.230.0090.00017.05
8.0.220.0000.00916.98
8.0.210.0050.00317.00
8.0.200.0040.00416.93
8.0.190.0000.00716.93
8.0.180.0030.00517.02
8.0.170.0040.00416.92
8.0.160.0070.00016.98
8.0.150.0000.00716.76
8.0.140.0030.00316.91
8.0.130.0000.00613.32
8.0.120.0030.00616.89
8.0.110.0040.00416.80
8.0.100.0000.00716.91
8.0.90.0040.00416.80
8.0.80.0060.01216.98
8.0.70.0080.00016.84
8.0.60.0080.00017.03
8.0.50.0080.00016.93
8.0.30.0090.01016.98
8.0.20.0080.01117.40
8.0.10.0000.00817.15
8.0.00.0090.01116.66
7.4.330.0020.00216.71
7.4.320.0040.00416.56
7.4.300.0000.00616.65
7.4.290.0050.00316.43
7.4.280.0090.00016.50
7.4.270.0000.00616.44
7.4.260.0030.00616.59
7.4.250.0040.00416.57
7.4.240.0010.00616.52
7.4.230.0030.00316.71
7.4.220.0040.01516.55
7.4.210.0060.01016.38
7.4.200.0070.00016.60
7.4.160.0090.00616.69
7.4.150.0240.00017.40
7.4.140.0050.01217.86
7.4.130.0110.00616.34
7.4.120.0080.01016.56
7.4.110.0030.01416.33
7.4.100.0120.00616.46
7.4.90.0130.00916.71
7.4.80.0140.01019.39
7.4.70.0090.01316.69
7.4.60.0060.01016.47
7.4.50.0120.00316.70
7.4.40.0090.00616.53
7.4.30.0130.00716.55
7.4.00.0070.00714.91
7.3.330.0040.00313.45
7.3.320.0020.00213.45
7.3.310.0000.00716.29
7.3.300.0030.00316.54
7.3.290.0060.00916.36
7.3.280.0060.01216.35
7.3.270.0130.01017.40
7.3.260.0090.00816.51
7.3.250.0140.00616.58
7.3.240.0120.00516.42
7.3.230.0140.00716.48
7.3.210.0060.01016.48
7.3.200.0030.01216.56
7.3.190.0110.01216.40
7.3.180.0000.02016.63
7.3.170.0100.01016.45
7.3.160.0100.00716.27
7.2.330.0070.01116.79
7.2.320.0040.01416.70
7.2.310.0140.00716.74
7.2.300.0060.01116.84
7.2.290.0110.00916.62
7.2.60.0130.00016.69
7.2.00.0030.00919.36
7.1.200.0060.00615.68
7.1.100.0000.01118.28
7.1.70.0070.01017.18
7.1.60.0030.00919.36
7.1.50.0080.00816.83
7.1.00.0030.07722.29
7.0.200.0040.00416.94
7.0.100.0130.07719.98
7.0.90.0270.09020.02
7.0.80.0130.07019.88
7.0.70.0000.05319.88
7.0.60.0100.06319.91
7.0.50.0100.08020.38
7.0.40.0100.08320.05
7.0.30.0100.08320.05
7.0.20.0100.06020.03
7.0.10.0130.04020.14
7.0.00.0170.09020.14
5.6.280.0030.04020.79
5.6.250.0170.05020.77
5.6.240.0070.08720.74
5.6.230.0100.03720.51
5.6.220.0100.04320.74
5.6.210.0100.08320.59
5.6.200.0200.05021.06
5.6.190.0100.07321.14
5.6.180.0100.08021.05
5.6.170.0070.05720.96
5.6.160.0070.06321.12
5.6.150.0030.06721.11
5.6.140.0070.04321.12
5.6.130.0000.04320.98
5.6.120.0070.04021.12
5.6.110.0000.04321.05
5.6.100.0130.05321.06
5.6.90.0070.07321.07
5.6.80.0070.07320.41
5.6.70.0130.03320.42
5.6.60.0070.08020.40
5.6.50.0030.04320.35
5.6.40.0200.03320.32
5.6.30.0030.08720.31
5.6.20.0100.04020.41
5.6.10.0130.06720.38
5.6.00.0130.07320.41
5.5.380.0100.05320.51
5.5.370.0100.05720.38
5.5.360.0030.07720.50
5.5.350.0070.07320.34
5.5.340.0070.04320.84
5.5.330.0170.03720.84
5.5.320.0170.05020.89
5.5.310.0100.04320.63
5.5.300.0070.04720.77
5.5.290.0070.08720.75
5.5.280.0070.08020.93
5.5.270.0030.08020.62
5.5.260.0130.08020.73
5.5.250.0100.04320.55
5.5.240.0100.04020.18
5.5.230.0030.08720.25
5.5.220.0070.07720.16
5.5.210.0100.07020.22
5.5.200.0070.08020.27
5.5.190.0100.07320.23
5.5.180.0200.06320.20
5.5.160.0070.06720.14
5.5.150.0100.03320.19
5.5.140.0170.05720.11
5.5.130.0130.07720.25
5.5.120.0100.05320.00
5.5.110.0100.04320.18
5.5.100.0170.06019.98
5.5.90.0070.07319.96
5.5.80.0070.08020.16
5.5.70.0100.04020.16
5.5.60.0070.07720.07
5.5.50.0030.08320.01
5.5.40.0100.07720.06
5.5.30.0030.04320.04
5.5.20.0130.07720.09
5.5.10.0170.07020.09
5.5.00.0100.07720.07

preferences:
44.1 ms | 400 KiB | 5 Q