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", -1)); } 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 : $this; } public static function maxValDirection($moves, $board, $player, $pos){ $best = Move::initializeEmpty(); foreach($moves as $m){ $m->setValue($board, $player, $pos); $best = $m->compare($best); } return $best; } public function setValue($board, $player, $pos){ $this->value = 1; } } $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.0090.00916.86
8.3.50.0170.00521.98
8.3.40.0090.00618.69
8.3.30.0110.00419.02
8.3.20.0040.00420.34
8.3.10.0050.00323.65
8.3.00.0040.00419.38
8.2.180.0090.00918.50
8.2.170.0160.00022.96
8.2.160.0030.01020.47
8.2.150.0000.00824.18
8.2.140.0000.00724.66
8.2.130.0060.00320.35
8.2.120.0040.00426.35
8.2.110.0060.00322.01
8.2.100.0090.00318.00
8.2.90.0090.00019.23
8.2.80.0000.00817.97
8.2.70.0040.00417.75
8.2.60.0000.00818.05
8.2.50.0060.00318.07
8.2.40.0000.00819.30
8.2.30.0070.00020.64
8.2.20.0030.00717.82
8.2.10.0000.00718.19
8.2.00.0070.00018.01
8.1.280.0080.00825.92
8.1.270.0040.00424.02
8.1.260.0050.00328.09
8.1.250.0040.00428.09
8.1.240.0060.00321.04
8.1.230.0090.00317.79
8.1.220.0000.00817.74
8.1.210.0060.00318.77
8.1.200.0000.01017.38
8.1.190.0040.00417.49
8.1.180.0040.00418.10
8.1.170.0030.00518.65
8.1.160.0040.00422.07
8.1.150.0000.00718.97
8.1.140.0040.00419.54
8.1.130.0000.00717.57
8.1.120.0000.00717.44
8.1.110.0000.00717.43
8.1.100.0030.00617.46
8.1.90.0040.00417.45
8.1.80.0070.00017.42
8.1.70.0040.00717.41
8.1.60.0140.00017.62
8.1.50.0080.00017.43
8.1.40.0040.00417.42
8.1.30.0040.00417.57
8.1.20.0030.00617.56
8.1.10.0080.00017.50
8.1.00.0040.00417.43
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0070.00018.46
8.0.270.0040.00417.20
8.0.260.0000.00717.34
8.0.250.0070.00016.94
8.0.240.0040.00417.03
8.0.230.0050.00316.93
8.0.220.0040.00416.95
8.0.210.0000.00817.01
8.0.200.0030.00317.05
8.0.190.0050.00317.01
8.0.180.0000.00817.01
8.0.170.0030.00616.97
8.0.160.0040.00417.11
8.0.150.0070.00016.91
8.0.140.0000.00716.91
8.0.130.0000.00513.40
8.0.120.0040.00416.78
8.0.110.0040.00416.89
8.0.100.0000.00716.93
8.0.90.0040.00417.05
8.0.80.0040.01117.02
8.0.70.0030.00516.92
8.0.60.0000.00816.80
8.0.50.0000.00816.96
8.0.30.0110.00817.10
8.0.20.0100.01117.40
8.0.10.0040.00417.11
8.0.00.0100.00916.78
7.4.330.0000.00516.83
7.4.320.0050.00316.61
7.4.300.0030.00316.60
7.4.290.0070.00016.44
7.4.280.0030.00616.52
7.4.270.0000.00716.63
7.4.260.0030.00316.58
7.4.250.0040.00416.50
7.4.240.0040.00416.57
7.4.230.0000.00716.37
7.4.220.0130.00716.72
7.4.210.0090.01216.68
7.4.200.0000.00716.63
7.4.160.0000.01516.44
7.4.150.0100.01017.40
7.4.140.0120.00517.86
7.4.130.0090.01416.55
7.4.120.0070.01116.51
7.4.110.0070.01016.59
7.4.100.0130.00716.39
7.4.90.0120.00916.69
7.4.80.0090.01319.39
7.4.70.0180.00316.48
7.4.60.0070.01016.60
7.4.50.0070.01016.27
7.4.40.0080.00816.64
7.4.30.0110.00716.58
7.4.00.0100.00715.05
7.3.330.0050.00013.38
7.3.320.0000.00513.30
7.3.310.0030.00316.45
7.3.300.0000.00716.30
7.3.290.0040.01116.38
7.3.280.0060.01216.36
7.3.270.0100.01017.40
7.3.260.0060.01216.32
7.3.250.0120.00816.47
7.3.240.0050.01316.37
7.3.230.0070.01816.39
7.3.210.0070.01016.48
7.3.200.0070.01016.37
7.3.190.0080.00816.46
7.3.180.0130.00316.36
7.3.170.0100.00716.42
7.3.160.0070.01016.50
7.3.120.0070.00714.84
7.3.110.0070.01114.98
7.3.100.0080.00414.62
7.3.90.0150.00314.92
7.3.80.0040.01114.86
7.3.70.0000.01814.95
7.3.60.0080.00414.83
7.3.50.0110.00614.66
7.3.40.0070.00415.01
7.3.30.0040.00814.94
7.3.20.0030.00716.75
7.3.10.0000.01016.69
7.3.00.0090.00616.64
7.2.330.0090.00916.71
7.2.320.0110.00716.79
7.2.310.0120.00416.45
7.2.300.0120.00616.82
7.2.290.0100.01016.64
7.2.250.0070.01015.25
7.2.240.0060.01314.96
7.2.230.0030.01615.06
7.2.220.0070.00414.89
7.2.210.0040.01214.89
7.2.200.0000.01414.83
7.2.190.0070.00715.00
7.2.180.0060.00315.10
7.2.170.0060.00915.14
7.2.60.0000.00916.69
7.2.00.0030.00719.32
7.1.330.0140.00315.75
7.1.320.0040.01115.83
7.1.310.0060.00915.76
7.1.300.0060.00615.75
7.1.290.0060.00615.78
7.1.280.0030.01015.68
7.1.270.0030.00515.81
7.1.260.0030.00615.82
7.1.200.0030.01015.58
7.1.100.0050.00517.86
7.1.70.0080.00816.83
7.1.60.0030.02019.36
7.1.50.0040.00716.80
7.1.00.0000.08022.43
7.0.200.0020.00516.86
7.0.60.0130.08019.81
7.0.50.0070.04717.88
7.0.40.0170.07320.25
7.0.30.0270.05720.08
7.0.20.0130.06720.07
7.0.10.0200.07320.09
7.0.00.0070.08720.19
5.6.280.0000.06021.13
5.6.210.0070.08020.72
5.6.200.0100.07718.22
5.6.190.0130.07720.67
5.6.180.0430.08020.68
5.6.170.0230.06320.39
5.6.160.0000.05720.52
5.6.150.0000.04318.21
5.6.140.0100.08718.28
5.6.130.0000.08718.14
5.6.120.0030.05321.00
5.6.110.0170.07721.15
5.6.100.0070.06721.02
5.6.90.0100.08021.02
5.6.80.0030.07020.34
5.5.350.0230.04320.42
5.5.340.0070.04317.96
5.5.330.0030.06320.21
5.5.320.0200.04020.33
5.5.310.0230.08020.29
5.5.300.0030.04717.98
5.5.290.0070.04717.97
5.5.280.0130.07320.70
5.5.270.0000.06320.88
5.5.260.0000.05320.96
5.5.250.0130.07720.70
5.5.240.0170.07720.17

preferences:
41.07 ms | 401 KiB | 5 Q