3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TestSampleClass { } class ParameterReflection extends ReflectionParameter { protected $isFromMethod = false; public function getDeclaringClass() { $phpReflection = parent::getDeclaringClass(); $zendReflection = new ReflectionClass($phpReflection->getName()); unset($phpReflection); return $zendReflection; } public function getClass() { $phpReflection = parent::getClass(); if ($phpReflection == null) { return null; } $zendReflection = new ClassReflection($phpReflection->getName()); unset($phpReflection); return $zendReflection; } public function getDeclaringFunction($reflectionClass = null) { $phpReflection = parent::getDeclaringFunction(); if ($phpReflection instanceof ReflectionMethod) { $zendReflection = new ReflectionMethod($this->getDeclaringClass()->getName(), $phpReflection->getName()); } else { $zendReflection = new ReflectionFunction($phpReflection->getName()); } unset($phpReflection); return $zendReflection; } public function getType() { $type = null; $checkDefault = true; if ($this->isArray()) { $type = 'array'; } elseif (($class = $this->getClass()) instanceof ReflectionClass) { $type = $class->getName(); } /*elseif ($docBlock = $this->getDeclaringFunction()->getDocBlock()) { $params = $docBlock->getTags('param'); if (isset($params[$this->getPosition()])) { $type = $params[$this->getPosition()]->getType(); $checkDefault = false; } }*/ var_dump($this->isDefaultValueAvailable()); if ($this->isDefaultValueAvailable() && $checkDefault) { if ($type === null) { $value = $this->getDefaultValue(); var_dump($value); $type = strtolower(gettype($value)); switch ($type) { case 'boolean' : $type = 'bool'; break; case 'integer' : $type = 'int'; break; } } else { if ($this->getDefaultValue() === null) { $type .= '|null'; } } } return $type; } } class TestSampleClass5 { /** * @param int $one Description for one * @param int Description for two * @param string $three Description for three * which spans multiple lines */ public function doSomething($one, $two = 2, $three = 'three', $empty = null, $string = 'somestring', $null = null, $int = 1, $bool = true, array $array, array $arrayOrNull = null, TestSampleClass $class, TestSampleClass $classOrNull = null) { return 'mixedValue'; } } $tests = array( // array('one', 'int'), // array('two', 'int'), // array('three', 'string'), array('empty', null), array('string', 'string'), array('null', 'null'), array('int', 'int'), array('bool', 'bool'), array('array', 'array'), array('arrayOrNull','array|null'), array('class', 'ZendTest\Code\Reflection\TestAsset\TestSampleClass'), array('classOrNull','ZendTest\Code\Reflection\TestAsset\TestSampleClass|null'), ); foreach($tests as $test) { $param = new ParameterReflection(array('TestSampleClass5', 'doSomething'), $test[0]); var_dump($param->getType()); }

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.0140.00416.72
8.3.50.0120.00817.49
8.3.40.0060.00918.82
8.3.30.0070.01119.01
8.3.20.0050.00318.95
8.3.10.0060.00320.61
8.3.00.0000.00919.50
8.2.180.0150.00025.92
8.2.170.0110.00422.96
8.2.160.0100.00722.13
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0050.00326.16
8.2.120.0080.00019.76
8.2.110.0040.00720.77
8.2.100.0040.00817.84
8.2.90.0030.00619.23
8.2.80.0000.00818.00
8.2.70.0090.00017.75
8.2.60.0000.00817.80
8.2.50.0090.00018.07
8.2.40.0080.00018.03
8.2.30.0050.00318.21
8.2.20.0040.00417.86
8.2.10.0040.00417.82
8.2.00.0040.00417.88
8.1.280.0090.00625.92
8.1.270.0000.00724.66
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0090.00020.75
8.1.230.0040.00821.02
8.1.220.0000.00817.79
8.1.210.0040.00418.95
8.1.200.0130.00017.24
8.1.190.0000.00817.53
8.1.180.0000.00818.10
8.1.170.0040.00418.91
8.1.160.0030.00518.91
8.1.150.0000.00718.58
8.1.140.0050.00517.53
8.1.130.0030.00517.82
8.1.120.0050.00317.43
8.1.110.0070.00017.46
8.1.100.0050.00217.43
8.1.90.0080.00017.40
8.1.80.0000.00717.46
8.1.70.0080.00017.49
8.1.60.0000.00817.64
8.1.50.0030.00617.49
8.1.40.0060.00317.61
8.1.30.0080.00017.63
8.1.20.0040.00417.73
8.1.10.0000.00717.58
8.1.00.0000.00817.52
8.0.300.0040.00420.16
8.0.290.0060.00316.75
8.0.280.0040.00418.44
8.0.270.0000.00717.15
8.0.260.0040.00418.49
8.0.250.0040.00417.12
8.0.240.0060.00317.05
8.0.230.0030.00317.02
8.0.220.0040.00417.02
8.0.210.0030.00316.96
8.0.200.0000.00717.06
8.0.190.0050.00317.07
8.0.180.0040.00417.04
8.0.170.0030.00617.02
8.0.160.0050.00217.09
8.0.150.0090.00016.95
8.0.140.0000.00816.98
8.0.130.0000.00613.39
8.0.120.0040.00416.86
8.0.110.0040.00416.86
8.0.100.0050.00216.86
8.0.90.0040.00417.01
8.0.80.0000.01417.04
8.0.70.0040.00416.80
8.0.60.0050.00216.95
8.0.50.0050.00317.05
8.0.30.0120.00817.26
8.0.20.0060.01417.15
8.0.10.0040.00417.07
8.0.00.0080.01217.04
7.4.330.0000.00513.01
7.4.320.0000.00716.45
7.4.300.0040.00416.48
7.4.290.0030.00316.43
7.4.280.0000.00716.63
7.4.270.0030.00316.53
7.4.260.0000.00513.28
7.4.250.0060.00316.42
7.4.240.0040.00416.42
7.4.230.0030.00316.58
7.4.220.0070.01816.61
7.4.210.0100.00516.59
7.4.200.0040.00416.54
7.4.190.0000.00716.60
7.4.160.0080.00816.65
7.4.150.0100.01016.62
7.4.140.0110.01016.64
7.4.130.0080.01116.63
7.4.120.0070.01016.59
7.4.110.0070.01016.67
7.4.100.0070.01116.39
7.4.90.0090.00916.58
7.4.80.0160.00316.39
7.4.70.0120.00616.24
7.4.60.0080.00816.64
7.4.50.0030.00316.47
7.4.40.0110.00716.39
7.4.30.0080.00916.39
7.4.00.0070.01015.00
7.3.330.0030.00313.52
7.3.320.0030.00313.40
7.3.310.0040.00416.27
7.3.300.0040.00416.41
7.3.290.0030.01116.46
7.3.280.0060.01016.43
7.3.270.0150.00416.45
7.3.260.0080.01016.50
7.3.250.0070.01416.61
7.3.240.0180.00016.64
7.3.230.0100.00716.41
7.3.210.0140.00316.57
7.3.200.0040.01519.39
7.3.190.0170.00316.66
7.3.180.0110.00916.35
7.3.170.0150.00016.63
7.3.160.0090.00616.66
7.3.120.0000.01314.68
7.3.10.0070.00716.74
7.3.00.0030.01416.65
7.2.330.0140.00316.76
7.2.320.0120.00616.77
7.2.310.0090.00916.66
7.2.300.0180.00616.93
7.2.290.0030.01316.65
7.2.130.0080.00416.96
7.2.120.0060.00616.76
7.2.110.0040.01116.71
7.2.100.0040.00917.06
7.2.90.0030.00916.82
7.2.80.0040.00816.77
7.2.70.0040.01117.03
7.2.60.0080.00416.88
7.2.50.0070.00717.11
7.2.40.0060.00616.89
7.2.30.0030.01016.90
7.2.20.0060.00916.85
7.2.10.0140.00017.16
7.2.00.0070.00518.02
7.1.250.0040.00715.77
7.1.200.0030.01015.99
7.1.100.0100.00718.30
7.1.70.0120.00017.18
7.1.60.0060.01619.40
7.1.50.0070.01816.91
7.1.00.0000.07022.41
7.0.200.0910.00614.97
7.0.140.0070.07322.05
7.0.120.0030.06722.05
7.0.60.0000.05720.06
7.0.50.0100.05017.94
7.0.40.0200.05720.25
7.0.30.0230.05320.30
7.0.20.0430.06320.22
7.0.10.0270.04020.17
7.0.00.0070.07720.12
5.6.280.0100.06721.04
5.6.210.0100.06720.70
5.6.200.0070.08318.22
5.6.190.0030.09020.34
5.6.180.0300.05020.67
5.6.170.0270.07020.71
5.6.160.0100.03720.57
5.6.150.0070.06018.25
5.6.140.0130.03318.27
5.6.130.0130.08018.16
5.6.120.0100.07721.03
5.6.110.0000.08321.07
5.6.100.0100.08320.99
5.6.90.0100.06021.14
5.6.80.0030.08020.43
5.6.70.0400.06720.40
5.5.350.0000.07320.45
5.5.340.0070.04317.96
5.5.330.0030.04320.37
5.5.320.0300.07320.35
5.5.310.0270.04020.42
5.5.300.0100.07717.94
5.5.290.0030.04017.97
5.5.280.0170.07720.76
5.5.270.0070.08720.90
5.5.260.0100.08320.75
5.5.250.0070.03720.49
5.5.240.0100.07320.26
5.4.450.0130.07319.57
5.4.440.0030.06319.48
5.4.430.0070.04319.18
5.4.420.0100.07319.53
5.4.410.0070.04319.20
5.4.400.0100.03319.25
5.4.390.0100.03719.20
5.4.380.0100.03018.86
5.4.370.0000.04318.85
5.4.360.0100.06719.14
5.4.350.0030.03719.21
5.4.340.0000.04019.25
5.4.320.0100.03718.85
5.4.310.0030.07719.20
5.4.300.0070.03319.23
5.4.290.0130.07319.14
5.4.280.0100.07318.86
5.4.270.0100.07019.16
5.4.260.0000.04018.85
5.4.250.0000.04719.20
5.4.240.0070.03719.14
5.4.230.0030.06719.14
5.4.220.0000.04019.24
5.4.210.0030.05719.16
5.4.200.0030.03719.13
5.4.190.0070.04019.09
5.4.180.0070.06719.23
5.4.170.0200.07019.11
5.4.160.0070.05319.06
5.4.150.0100.05719.12
5.4.140.0030.05316.36
5.4.130.0100.07016.42
5.4.120.0100.06316.29
5.4.110.0000.06016.39
5.4.100.0070.07716.39
5.4.90.0100.04716.46
5.4.80.0070.04716.50
5.4.70.0000.04316.44
5.4.60.0000.04016.29
5.4.50.0100.05316.41
5.4.40.0130.03316.44
5.4.30.0130.06316.37
5.4.20.0270.05716.36
5.4.10.0170.06316.52
5.4.00.0130.07015.80
5.3.290.0070.06314.76
5.3.280.0000.08014.68
5.3.270.0030.08314.64
5.3.260.0030.08014.65
5.3.250.0130.06714.78
5.3.240.0170.06714.68
5.3.230.0000.05014.79
5.3.220.0100.06014.75
5.3.210.0000.04714.65
5.3.200.0030.08014.65
5.3.190.0000.04314.76
5.3.180.0100.07014.60
5.3.170.0130.07014.64
5.3.160.0130.03714.63
5.3.150.0030.06714.64
5.3.140.0100.04314.64
5.3.130.0070.07014.46
5.3.120.0130.06314.59
5.3.110.0030.07714.47
5.3.100.0100.03714.13
5.3.90.0030.05014.05
5.3.80.0130.06714.05
5.3.70.0030.05714.11
5.3.60.0070.07314.20
5.3.50.0100.07313.98
5.3.40.0130.06714.03
5.3.30.0070.04313.85
5.3.20.0100.07013.64
5.3.10.0070.07013.84
5.3.00.0070.07313.72
5.2.170.0000.06311.16
5.2.160.0030.03311.22
5.2.150.0030.05011.23
5.2.140.0130.03011.13
5.2.130.0030.06311.06
5.2.120.0030.06011.29
5.2.110.0000.04011.19
5.2.100.0030.06711.14
5.2.90.0070.04011.16
5.2.80.0100.03711.14
5.2.70.0000.03311.17
5.2.60.0000.03311.05
5.2.50.0000.06311.21
5.2.40.0070.06010.92
5.2.30.0100.06311.01
5.2.20.0070.03311.15
5.2.10.0000.06310.90
5.2.00.0070.04710.75
5.1.60.0070.03010.00
5.1.50.0030.0339.94
5.1.40.0070.03710.03
5.1.30.0030.04310.26
5.1.20.0130.04310.46
5.1.10.0000.03010.02
5.1.00.0000.05310.25
5.0.50.0030.0408.59
5.0.40.0070.0338.41
5.0.30.0030.0678.41
5.0.20.0030.0438.41
5.0.10.0030.0338.41
5.0.00.0000.0708.41
4.4.90.0070.0138.41
4.4.80.0070.0138.41
4.4.70.0000.0338.41
4.4.60.0000.0178.41
4.4.50.0070.0278.41
4.4.40.0070.0238.41
4.4.30.0070.0238.41
4.4.20.0000.0208.41
4.4.10.0030.0238.41
4.4.00.0000.0608.41
4.3.110.0000.0378.41
4.3.100.0100.0278.41
4.3.90.0000.0178.41
4.3.80.0000.0578.41
4.3.70.0030.0308.41
4.3.60.0030.0208.41
4.3.50.0000.0178.41
4.3.40.0030.0378.41
4.3.30.0000.0278.41
4.3.20.0000.0338.41
4.3.10.0000.0178.41
4.3.00.0030.0278.41

preferences:
53.16 ms | 401 KiB | 5 Q