3v4l.org

run code in 300+ PHP versions simultaneously
<?php //////////////////////////////////////////////// // // File: abstract.WorkUnitDataType.php // //////////////////////////////////////////////// // Author: Adam Profitt // // Comments: // Work unit enumeration sim class // //////////////////////////////////////////////// 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 static $cachedConstantArr; private $value; private $name; //============================================== // construct //============================================== final public function __construct() { $name = get_class($this); $this->value = WorkUnitDataType::getValueFromName($name); $this->name = $name; } //============================================== // accessing //============================================== final public function getName() { return $this->name; } final public function getValue() { return $this->value; } //============================================== // convenience //============================================== final public static function NoneDataType() { return new NoneDataType();} final public static function BoolDataType() { return new BoolDataType();} final public static function NumericDataType(){ return new NumericDataType();} final public static function StringDataType() { return new StringDataType();} final public static function ArrayDataType() { return new ArrayDataType();} final public static function JsonDataType() { return new JsonDataType();} final public static function UrlDataType() { return new UrlDataType();} final public static function FileDataType() { return new FileDataType();} //============================================== // utility //============================================== final private static function getConstants() { if (self::$cachedConstantArr == NULL) { self::$cachedConstantArr = array(); } $calledClass = get_called_class(); if (!array_key_exists($calledClass, self::$cachedConstantArr)) { $reflect = new ReflectionClass($calledClass); self::$cachedConstantArr[$calledClass] = $reflect->getConstants(); } return self::$cachedConstantArr[$calledClass]; } final public static function getNameFromValue($const) { foreach (self::getConstants() as $name => $value) { if ($value == $const) { return $name; } } return Null; } final public static function getValueFromName($text) { foreach (self::getConstants() 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.0100.00716.88
8.3.50.0080.00816.42
8.3.40.0070.00718.95
8.3.30.0150.00618.79
8.3.20.0040.00420.30
8.3.10.0110.00321.91
8.3.00.0040.01223.65
8.2.180.0110.01116.74
8.2.170.0140.00722.96
8.2.160.0100.00720.29
8.2.150.0120.00824.18
8.2.140.0040.01424.66
8.2.130.0090.00919.95
8.2.120.0070.00726.35
8.2.110.0060.00321.00
8.2.100.0040.00817.97
8.2.90.0080.00019.17
8.2.80.0050.00317.97
8.2.70.0040.00417.63
8.2.60.0040.00417.93
8.2.50.0110.00018.07
8.2.40.0070.00320.53
8.2.30.0040.00419.58
8.2.20.0070.00017.82
8.2.10.0000.00718.21
8.2.00.0000.00818.12
8.1.280.0110.00725.92
8.1.270.0000.00823.93
8.1.260.0050.00328.09
8.1.250.0050.00328.09
8.1.240.0090.00023.80
8.1.230.0040.00822.82
8.1.220.0110.00017.74
8.1.210.0030.00618.77
8.1.200.0050.00517.35
8.1.190.0040.00417.35
8.1.180.0030.00518.10
8.1.170.0000.00818.45
8.1.160.0070.00020.84
8.1.150.0030.00618.92
8.1.140.0000.00819.65
8.1.130.0030.00317.64
8.1.120.0000.00717.52
8.1.110.0040.00417.48
8.1.100.0040.00417.55
8.1.90.0030.00617.50
8.1.80.0000.00817.36
8.1.70.0050.00217.44
8.1.60.0000.00917.54
8.1.50.0030.00617.54
8.1.40.0040.00417.53
8.1.30.0050.00317.61
8.1.20.0040.00417.71
8.1.10.0030.00517.58
8.1.00.0060.00317.52
8.0.300.0000.00718.77
8.0.290.0050.00216.75
8.0.280.0000.00718.48
8.0.270.0080.00017.20
8.0.260.0030.00317.34
8.0.250.0000.00717.05
8.0.240.0030.00617.04
8.0.230.0050.00317.08
8.0.220.0060.00316.87
8.0.210.0040.00416.95
8.0.200.0000.00817.00
8.0.190.0030.00617.05
8.0.180.0030.00716.99
8.0.170.0080.00016.91
8.0.160.0040.00416.87
8.0.150.0040.00417.03
8.0.140.0000.00716.92
8.0.130.0000.00513.41
8.0.120.0000.00816.87
8.0.110.0040.00417.01
8.0.100.0040.00416.94
8.0.90.0060.00316.88
8.0.80.0040.01516.94
8.0.70.0050.00316.85
8.0.60.0070.00016.96
8.0.50.0040.00417.01
8.0.30.0100.00517.16
8.0.20.0140.00717.40
8.0.10.0030.00517.14
8.0.00.0110.00817.07
7.4.330.0050.00016.77
7.4.320.0030.00316.60
7.4.300.0030.00316.61
7.4.290.0030.00316.61
7.4.280.0030.00616.54
7.4.270.0030.00316.55
7.4.260.0000.00716.55
7.4.250.0030.00316.50
7.4.240.0050.00216.50
7.4.230.0040.00416.36
7.4.220.0080.01116.52
7.4.210.0140.00716.42
7.4.200.0040.00416.70
7.4.160.0030.01316.65
7.4.150.0120.00617.40
7.4.140.0050.01617.86
7.4.130.0090.00916.50
7.4.120.0120.00616.59
7.4.110.0060.01216.70
7.4.100.0040.01216.69
7.4.90.0110.00616.71
7.4.80.0000.01919.39
7.4.70.0090.01216.50
7.4.60.0100.00716.66
7.4.50.0130.00316.46
7.4.40.0110.00816.39
7.4.30.0120.00616.55
7.4.00.0160.00015.13
7.3.330.0060.00013.44
7.3.320.0070.00013.30
7.3.310.0040.00416.33
7.3.300.0030.00316.29
7.3.290.0070.00816.44
7.3.280.0070.01016.46
7.3.270.0070.01717.40
7.3.260.0090.00916.39
7.3.250.0070.01016.42
7.3.240.0080.01116.64
7.3.230.0070.01016.66
7.3.210.0130.00316.68
7.3.200.0120.00619.39
7.3.190.0040.01716.66
7.3.180.0130.01016.44
7.3.170.0040.01416.40
7.3.160.0130.00916.49
7.2.330.0040.01516.81
7.2.320.0100.00716.62
7.2.310.0040.01216.82
7.2.300.0120.00616.49
7.2.290.0060.01216.84
7.2.60.0060.00616.75
7.2.00.0060.00819.61
7.1.200.0110.00015.68
7.1.100.0000.01118.22
7.1.70.0030.00617.15
7.1.60.0100.01419.18
7.1.50.0130.01016.93
7.1.00.0100.07022.31
7.0.200.0230.01016.47
7.0.100.0230.08019.95
7.0.90.0270.08019.97
7.0.80.0100.07719.85
7.0.70.0230.06720.04
7.0.60.0200.08719.99
7.0.50.0000.04720.33
7.0.40.0070.04320.13
7.0.30.0170.07320.18
7.0.20.0100.07020.14
7.0.10.0070.06720.04
7.0.00.0030.08320.08
5.6.280.0030.05321.20
5.6.250.0070.05020.86
5.6.240.0170.05320.80
5.6.230.0130.07320.58
5.6.220.0030.04320.63
5.6.210.0170.07320.72
5.6.200.0070.04021.17
5.6.190.0070.08721.20
5.6.180.0030.08721.13
5.6.170.0030.09021.20
5.6.160.0000.08721.10
5.6.150.0030.08721.11
5.6.140.0030.05021.16
5.6.130.0100.07321.13
5.6.120.0200.07321.19
5.6.110.0100.08321.14
5.6.100.0030.08721.09
5.6.90.0130.08321.11
5.6.80.0030.08020.52
5.6.70.0130.07320.57
5.6.60.0030.05320.52
5.6.50.0100.06720.57
5.6.40.0200.06320.52
5.6.30.0170.07320.58
5.6.20.0070.05320.38
5.6.10.0030.08320.61
5.6.00.0100.07720.48
5.5.380.0030.06720.43
5.5.370.0000.08720.64
5.5.360.0030.08320.45
5.5.350.0030.08720.48
5.5.340.0070.04020.86
5.5.330.0130.07020.82
5.5.320.0130.08020.83
5.5.310.0170.07020.88
5.5.300.0070.06321.00
5.5.290.0100.07721.00
5.5.280.0030.08720.93
5.5.270.0030.09020.90
5.5.260.0030.05720.97
5.5.250.0030.09020.53
5.5.240.0070.04020.30
5.5.230.0070.04720.34
5.5.220.0130.04320.33
5.5.210.0130.04020.32
5.5.200.0000.07320.17
5.5.190.0070.07720.19
5.5.180.0070.10020.25
5.5.160.0070.07320.35
5.5.150.0070.07020.20
5.5.140.0100.07020.23
5.5.130.0070.05020.30
5.5.120.0100.06320.22
5.5.110.0070.04320.29
5.5.100.0070.04320.20
5.5.90.0100.07020.16
5.5.80.0100.07720.15
5.5.70.0030.07320.16
5.5.60.0070.06720.02
5.5.50.0070.06320.22
5.5.40.0030.08020.22
5.5.30.0100.07720.19
5.5.20.0030.07720.00
5.5.10.0130.04320.16
5.5.00.0130.04020.16

preferences:
52.63 ms | 400 KiB | 5 Q