3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class WorkUnitDataType { //============================================== // consts / vars //============================================== const NoneDataType = 0; const BoolDataType = 1; const NumericDataType = 2; const StringDataType = 3; const ArrayDataType = 4; const JsonDataType = 5; const UrlDataType = 6; const FileDataType = 7; private $value; private $name; private $cachedConstantArr; //============================================== // construct //============================================== protected function __construct() { $this->setByName(get_class($this)); $this->cacheConstArray(); } //============================================== // accessing //============================================== public function getName() { return $this->name; } public function getValue() { return $this->value; } private function cacheConstArray() { $class = new ReflectionClass('WorkUnitDataType'); $this->cachedConstantArr = $class->getConstants(); } //============================================== // convenience //============================================== public static function NoneDataType() { return new NoneDataType();} public static function BoolDataType() { return new BoolDataType();} public static function NumericDataType(){ return new NumericDataType();} public static function StringDataType() { return new StringDataType();} public static function ArrayDataType() { return new ArrayDataType();} public static function JsonDataType() { return new JsonDataType();} public static function UrlDataType() { return new UrlDataType();} public static function FileDataType() { return new FileDataType();} //============================================== // utility //============================================== protected function setByValue($value) { if (is_int($value)) { $this->value = $value; $this->name = WorkUnitDataType::getNameFromValue($value); } } protected function setByName($name) { if (is_string($name)) { $this->value = WorkUnitDataType::getValueFromName($name); $this->name = $name; } } public static function getNameFromValue($const) { foreach ($this->cachedConstantArr as $name => $value) { if ($value == $const) { return $name; } } return Null; } public static function getValueFromName($text) { foreach ($this->cachedConstantArr as $name => $value) { if ($name == $text) { return $value; } } return -1; } } class NoneDataType extends WorkUnitDataType {} class BoolDataType extends WorkUnitDataType {} class NumericDataType extends WorkUnitDataType {} class StringDataType extends WorkUnitDataType {} class ArrayDataType extends WorkUnitDataType {} class JsonDataType extends WorkUnitDataType {} class UrlDataType extends WorkUnitDataType {} class FileDataType extends WorkUnitDataType {} $a = WorkUnitDataType::NoneDataType(); var_dump($a); echo "\n\n"; echo $a->toString() . "\n"; echo $a->toValue() . "\n";

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.00716.61
8.3.50.0170.00316.20
8.3.40.0070.01118.96
8.3.30.0110.01118.57
8.3.20.0100.00720.29
8.3.10.0060.01221.72
8.3.00.0040.01223.59
8.2.180.0000.01618.18
8.2.170.0070.01422.96
8.2.160.0070.00720.39
8.2.150.0040.00424.18
8.2.140.0070.00024.66
8.2.130.0080.00019.70
8.2.120.0000.00826.35
8.2.110.0110.00020.97
8.2.100.0090.00317.91
8.2.90.0030.00619.08
8.2.80.0040.00417.97
8.2.70.0060.00317.50
8.2.60.0040.00417.80
8.2.50.0000.00818.07
8.2.40.0080.00420.50
8.2.30.0000.00819.47
8.2.20.0040.00417.70
8.2.10.0030.00617.91
8.2.00.0000.00818.11
8.1.280.0040.01125.92
8.1.270.0070.01323.80
8.1.260.0080.00028.09
8.1.250.0080.00028.09
8.1.240.0040.00422.47
8.1.230.0080.00419.01
8.1.220.0050.00317.79
8.1.210.0060.00318.77
8.1.200.0000.01017.22
8.1.190.0040.00417.00
8.1.180.0030.00518.10
8.1.170.0040.00418.52
8.1.160.0040.00420.68
8.1.150.0050.00318.71
8.1.140.0000.00819.40
8.1.130.0040.00417.53
8.1.120.0040.00417.43
8.1.110.0000.00717.37
8.1.100.0030.00617.38
8.1.90.0090.00017.43
8.1.80.0020.00517.34
8.1.70.0000.00717.35
8.1.60.0040.00417.45
8.1.50.0000.00817.43
8.1.40.0040.00417.49
8.1.30.0030.00617.52
8.1.20.0000.00817.46
8.1.10.0040.00417.48
8.1.00.0100.00017.45
8.0.300.0050.00218.77
8.0.290.0070.00016.58
8.0.280.0030.00318.29
8.0.270.0000.00717.18
8.0.260.0030.00317.16
8.0.250.0070.00017.02
8.0.240.0000.00816.92
8.0.230.0070.00016.94
8.0.220.0000.01116.96
8.0.210.0000.00716.89
8.0.200.0070.00016.93
8.0.190.0040.00416.86
8.0.180.0030.00616.98
8.0.170.0040.00416.89
8.0.160.0070.00017.04
8.0.150.0070.00016.94
8.0.140.0070.00016.86
8.0.130.0000.00613.39
8.0.120.0030.00616.94
8.0.110.0030.00516.82
8.0.100.0040.00416.87
8.0.90.0000.00716.76
8.0.80.0130.00316.90
8.0.70.0080.00016.72
8.0.60.0000.00716.78
8.0.50.0000.00716.95
8.0.30.0090.00917.13
8.0.20.0090.01317.40
8.0.10.0040.00416.95
8.0.00.0090.00916.65
7.4.330.0000.00516.74
7.4.320.0030.00316.45
7.4.300.0080.00016.43
7.4.290.0070.00016.59
7.4.280.0050.00516.50
7.4.270.0000.00716.46
7.4.260.0070.00016.40
7.4.250.0000.00916.42
7.4.240.0050.00216.46
7.4.230.0040.00416.43
7.4.220.0040.01416.52
7.4.210.0030.01616.55
7.4.200.0040.00416.64
7.4.160.0000.01616.47
7.4.150.0160.00317.40
7.4.140.0110.00917.86
7.4.130.0140.00616.42
7.4.120.0100.00916.52
7.4.110.0090.00916.43
7.4.100.0160.00616.52
7.4.90.0040.01516.44
7.4.80.0120.00619.39
7.4.70.0100.00716.48
7.4.60.0060.01016.47
7.4.50.0070.01016.46
7.4.40.0080.00916.63
7.4.30.0170.00716.52
7.4.00.0000.01814.77
7.3.330.0000.00713.26
7.3.320.0040.00413.39
7.3.310.0000.00816.50
7.3.300.0070.00016.26
7.3.290.0090.00916.42
7.3.280.0090.00816.36
7.3.270.0190.00617.40
7.3.260.0070.01816.25
7.3.250.0150.00616.42
7.3.240.0080.00816.53
7.3.230.0100.00716.59
7.3.210.0040.01816.59
7.3.200.0120.00919.39
7.3.190.0230.02516.46
7.3.180.0070.01016.38
7.3.170.0130.00316.61
7.3.160.0070.00916.52
7.2.330.0160.00316.54
7.2.320.0130.00316.78
7.2.310.0070.01416.56
7.2.300.0110.00916.57
7.2.290.0070.01016.72
7.2.60.0000.01616.94
7.2.00.0000.01319.50
7.1.200.0060.00615.86
7.1.100.0070.00318.00
7.1.70.0040.00416.82
7.1.60.0070.01819.18
7.1.50.0030.01017.01
7.1.00.0000.08022.51
7.0.200.0410.00716.38
7.0.100.0400.07719.93
7.0.90.0430.06319.94
7.0.80.0570.06319.91
7.0.70.0570.07719.93
7.0.60.0530.07320.02
7.0.50.0470.08720.38
7.0.40.0100.07720.05
7.0.30.0070.08720.09
7.0.20.0200.07320.15
7.0.10.0230.07020.13
7.0.00.0130.08020.08
5.6.280.0030.04021.21
5.6.250.0100.08320.88
5.6.240.0030.08720.64
5.6.230.0100.08720.72
5.6.220.0070.07720.68
5.6.210.0100.06720.66
5.6.200.0070.08021.16
5.6.190.0130.05321.16
5.6.180.0100.08321.12
5.6.170.0100.07321.27
5.6.160.0170.07721.10
5.6.150.0100.07721.05
5.6.140.0130.06321.12
5.6.130.0200.06721.14
5.6.120.0170.07321.05
5.6.110.0130.07021.19
5.6.100.0100.07721.16
5.6.90.0130.07720.96
5.6.80.0200.06720.50
5.6.70.0070.06020.58
5.6.60.0130.07720.54
5.6.50.0030.04720.50
5.6.40.0030.08720.51
5.6.30.0070.06320.50
5.6.20.0030.08320.55
5.6.10.0230.06020.46
5.6.00.0070.08320.53
5.5.380.0200.07020.43
5.5.370.0100.07320.45
5.5.360.0030.08720.58
5.5.350.0000.08720.55
5.5.340.0170.08020.85
5.5.330.0100.08020.98
5.5.320.0170.06720.96
5.5.310.0170.06720.95
5.5.300.0170.06720.92
5.5.290.0070.08020.98
5.5.280.0100.08320.96
5.5.270.0070.05721.01
5.5.260.0100.08020.96
5.5.250.0000.05320.71
5.5.240.0070.08020.38
5.5.230.0100.07720.31
5.5.220.0100.05320.38
5.5.210.0000.07720.36
5.5.200.0100.07320.21
5.5.190.0130.07320.36
5.5.180.0130.07320.27
5.5.160.0070.08020.37
5.5.150.0100.08020.30
5.5.140.0030.05320.21
5.5.130.0070.06720.35
5.5.120.0070.06020.30
5.5.110.0030.08720.27
5.5.100.0100.08020.25
5.5.90.0130.07720.19
5.5.80.0130.06720.15
5.5.70.0030.07720.02
5.5.60.0030.08020.11
5.5.50.0030.06320.16
5.5.40.0100.07320.23
5.5.30.0100.07720.17
5.5.20.0030.08320.11
5.5.10.0030.07320.15
5.5.00.0100.07720.14

preferences:
59.36 ms | 400 KiB | 5 Q