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)
5.6.150.0000.04018.20
5.6.140.0070.04018.25
5.6.130.0070.04018.14
5.6.120.0300.03721.02
5.6.110.0070.08721.14
5.6.100.0070.04020.90
5.6.90.0130.07720.96
5.6.80.0130.07320.38
5.5.300.0030.05318.07
5.5.290.0070.03718.08
5.5.280.0070.08020.68
5.5.270.0100.08320.88
5.5.260.0030.04320.88
5.5.250.0130.07720.71
5.5.240.0170.03720.16

preferences:
145.43 ms | 939 KiB | 8 Q