3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php abstract class WorkUnitDataType { //============================================== // consts / vars //============================================== const NoneDataType = 0; const BoolDataType = 1; const StringDataType = 2; const ArrayDataType = 3; const JsonDataType = 4; const UrlDataType = 5; const FileDataType = 6; private $value; private $name; //============================================== // construct //============================================== protected function __construct() { $this->setByName(get_class($this)); } protected function setByValue($value) { if (is_int($value)) { $this->value = $value; $this->name = WorkUnitDataType::getNameFromConst($value); } } protected function setByName($name) { if (is_string($name)) { $this->value = $this->name = $name; } } //============================================== // accessing //============================================== public function toString() { return $this->name; } public function toValue() { return $this->value; } //============================================== // convenience //============================================== public static function None() { return new NoneDataType();} public static function Bool() { return new BoolDataType();} public static function String() { return new StringDataType();} public static function Array() { return new ArrayDataType();} public static function Json() { return new JsonDataType();} public static function Url() { return new UrlDataType();} public static function File() { return new FileDataType();} //============================================== // utility //============================================== public static function getNameFromConst($const) { $class = new ReflectionClass('WorkUnitDataType'); $constants = $class->getConstants(); foreach ($constants as $name => $value) { if ($value == $const) { return $name; } } return Null; } public static function getValueFromName($text) { $class = new ReflectionClass('WorkUnitDataType'); $constants = $class->getConstants(); foreach ($constants as $name => $value) { if ($name == $text) { return $value; } } return -1; } } class NoneDataType extends WorkUnitDataType {} class BoolDataType extends WorkUnitDataType {} class StringDataType extends WorkUnitDataType {} class ArrayDataType extends WorkUnitDataType {} class JsonDataType extends WorkUnitDataType {} class UrlDataType extends WorkUnitDataType {} class FileDataType extends WorkUnitDataType {} $a = WorkUnitDataType::None(); var_dump($a);
based on bYhs0

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).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.3.10.0050.00716.53
7.3.00.0040.00516.66
7.2.130.0070.00716.93
7.2.120.0070.00516.94
7.2.110.0060.00816.85
7.2.100.0090.00516.95
7.2.90.0030.00816.80
7.2.80.0050.00716.98
7.2.70.0050.00816.88
7.2.60.0060.00616.96
7.2.50.0060.00817.03
7.2.40.0070.00717.02
7.2.30.0020.00817.00
7.2.20.0050.00916.87
7.2.10.0090.00616.82
7.2.00.0050.01017.53
7.1.250.0070.00515.63
7.1.200.0030.01015.84
7.1.100.0030.00918.00
7.1.70.0000.00716.95
7.1.60.0100.01319.18
7.1.50.0100.00316.96
7.1.00.0000.07722.48
7.0.200.0190.01316.38
7.0.100.0170.05319.97
7.0.90.0270.06720.07
7.0.80.0170.08720.17
7.0.70.0030.08319.95
7.0.60.0170.07019.93
7.0.50.0100.08320.35
7.0.40.0030.08320.15
7.0.30.0070.08020.00
7.0.20.0070.08020.15
7.0.10.0030.08720.10
7.0.00.0100.08019.94
5.6.280.0000.04020.93
5.6.250.0200.07020.79
5.6.240.0100.04720.68
5.6.230.0130.07720.52
5.6.220.0100.07720.50
5.6.210.0130.06720.64
5.6.200.0070.06321.05
5.6.190.0030.08020.98
5.6.180.0070.07021.03
5.6.170.0070.08321.12
5.6.160.0130.07321.06
5.6.150.0100.08321.10
5.6.140.0070.08021.06
5.6.130.0000.05721.00
5.6.120.0100.08021.03
5.6.110.0100.07721.09
5.6.100.0130.08021.10
5.6.90.0170.05721.04
5.6.80.0170.07020.38
5.6.70.0070.04720.43
5.6.60.0000.06720.44
5.6.50.0100.08020.31
5.6.40.0100.07320.55
5.6.30.0030.05720.39
5.6.20.0330.05020.47
5.6.10.0030.07720.44
5.6.00.0030.06020.39
5.5.380.0170.06720.44
5.5.370.0100.05720.46
5.5.360.0100.08020.43
5.5.350.0100.06720.40
5.5.340.0130.06020.77
5.5.330.0030.08720.91
5.5.320.0170.07320.93
5.5.310.0100.07720.82
5.5.300.0030.07720.93
5.5.290.0130.08020.89
5.5.280.0130.07720.75
5.5.270.0100.08320.89
5.5.260.0100.08720.75
5.5.250.0070.07720.71
5.5.240.0000.08320.18
5.5.230.0030.06720.29
5.5.220.0170.06020.17
5.5.210.0130.07720.13
5.5.200.0070.07320.01
5.5.190.0130.07320.16
5.5.180.0030.08720.20
5.5.160.0100.07320.23
5.5.150.0070.07320.14
5.5.140.0170.05720.24
5.5.130.0130.08020.14
5.5.120.0030.08320.29
5.5.110.0070.07320.14
5.5.100.0030.07320.00
5.5.90.0070.08320.12
5.5.80.0130.06720.05
5.5.70.0100.07720.02
5.5.60.0030.05720.07
5.5.50.0070.07720.05
5.5.40.0100.05720.16
5.5.30.0070.07020.11
5.5.20.0100.07720.07
5.5.10.0100.07720.04
5.5.00.0030.07319.98