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, $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.40.0100.00618.79
8.3.30.0160.00018.96
8.3.20.0030.00618.90
8.3.10.0090.00018.87
8.3.00.0000.00919.50
8.2.170.0110.00422.96
8.2.160.0130.00618.96
8.2.150.0060.00324.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0070.00020.84
8.2.110.0110.00020.32
8.2.100.0030.00917.91
8.2.90.0060.00317.88
8.2.80.0000.00818.73
8.2.70.0040.00417.48
8.2.60.0050.00317.75
8.2.50.0040.00418.05
8.2.40.0050.00319.35
8.2.30.0090.00017.85
8.2.20.0060.00317.84
8.2.10.0050.00217.81
8.2.00.0030.00617.87
8.1.270.0060.00323.99
8.1.260.0000.00826.35
8.1.250.0060.00328.09
8.1.240.0000.00923.89
8.1.230.0090.00321.04
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0000.00817.36
8.1.190.0040.00417.36
8.1.180.0080.00018.10
8.1.170.0030.00517.62
8.1.160.0040.00419.00
8.1.150.0000.00818.71
8.1.140.0000.00817.49
8.1.130.0000.00719.10
8.1.120.0040.00417.48
8.1.110.0080.00017.54
8.1.100.0070.00017.49
8.1.90.0000.00717.43
8.1.80.0040.00417.50
8.1.70.0080.00017.41
8.1.60.0000.00917.45
8.1.50.0090.00017.45
8.1.40.0000.00917.60
8.1.30.0060.00317.69
8.1.20.0040.00417.60
8.1.10.0030.00617.59
8.1.00.0030.00517.57
8.0.300.0000.00718.77
8.0.290.0090.00017.00
8.0.280.0000.00718.67
8.0.270.0070.00017.30
8.0.260.0040.00416.86
8.0.250.0040.00417.04
8.0.240.0020.00517.05
8.0.230.0040.00416.94
8.0.220.0000.00717.00
8.0.210.0040.00416.99
8.0.200.0000.00717.06
8.0.190.0040.00417.07
8.0.180.0060.00616.94
8.0.170.0030.00616.85
8.0.160.0000.00817.04
8.0.150.0000.00816.83
8.0.140.0000.00916.85
8.0.130.0030.00313.41
8.0.120.0000.00816.83
8.0.110.0040.00417.05
8.0.100.0040.00416.98
8.0.90.0000.00816.98
8.0.80.0070.01516.88
8.0.70.0080.00016.94
8.0.60.0000.00917.03
8.0.50.0030.00616.82
8.0.30.0100.01017.07
8.0.20.0110.00817.21
8.0.10.0000.00816.98
8.0.00.0100.01216.74
7.4.330.0050.00013.01
7.4.320.0030.00316.64
7.4.300.0070.00016.50
7.4.290.0000.00816.51
7.4.280.0000.00816.51
7.4.270.0030.00316.61
7.4.260.0000.00513.30
7.4.250.0040.00416.54
7.4.240.0050.00316.51
7.4.230.0030.00816.73
7.4.220.0130.00716.57
7.4.210.0080.00816.72
7.4.200.0040.00316.53
7.4.190.0020.00516.58
7.4.160.0040.01216.52
7.4.150.0100.01616.55
7.4.140.0100.01016.47
7.4.130.0120.00916.58
7.4.120.0090.01216.52
7.4.110.0060.01216.60
7.4.100.0120.00816.51
7.4.90.0090.01016.52
7.4.80.0120.00619.39
7.4.70.0110.00516.61
7.4.60.0030.01316.67
7.4.50.0050.00016.46
7.4.40.0070.01016.59
7.4.30.0030.01416.37
7.4.00.0070.00714.92
7.3.330.0030.00413.32
7.3.320.0030.00313.41
7.3.310.0030.00316.35
7.3.300.0070.00016.45
7.3.290.0100.00716.45
7.3.280.0070.00716.42
7.3.270.0040.01316.79
7.3.260.0160.00816.47
7.3.250.0120.00716.43
7.3.240.0130.00416.45
7.3.230.0100.00716.55
7.3.210.0100.00616.70
7.3.200.0040.01216.56
7.3.190.0150.00916.45
7.3.180.0030.01316.59
7.3.170.0100.00716.55
7.3.160.0090.00916.59
7.3.120.0040.01115.02
7.3.10.0080.00616.78
7.3.00.0030.00816.45
7.2.330.0070.01116.84
7.2.320.0090.00916.56
7.2.310.0090.01216.84
7.2.300.0060.01616.60
7.2.290.0140.00716.93
7.2.130.0030.01416.82
7.2.120.0020.01316.99
7.2.110.0050.01116.97
7.2.100.0090.00217.05
7.2.90.0110.00516.92
7.2.80.0020.00816.96
7.2.70.0080.00516.83
7.2.60.0050.00717.02
7.2.50.0080.00816.97
7.2.40.0090.00616.78
7.2.30.0100.00617.01
7.2.20.0040.00616.81
7.2.10.0080.00417.01
7.2.00.0030.01117.78
7.1.250.0050.00915.80
7.1.200.0120.00415.64
7.1.100.0590.00315.62
7.1.70.0040.00417.37
7.1.60.0100.01019.30
7.1.50.0100.00716.80
7.1.00.0030.07722.48
7.0.200.0050.00316.63
7.0.140.0030.07322.07
7.0.120.0070.07022.23
7.0.60.0100.07321.88
7.0.50.0000.06317.90
7.0.40.0100.04020.04
7.0.30.0130.04720.16
7.0.20.0170.04320.38
7.0.10.0000.08320.27
7.0.00.0030.08720.25
5.6.280.0070.07021.05
5.6.210.0100.07720.68
5.6.200.0000.06318.19
5.6.190.0030.05020.55
5.6.180.0200.05720.47
5.6.170.0230.04320.48
5.6.160.0070.04320.43
5.6.150.0070.03718.25
5.6.140.0070.05018.10
5.6.130.0030.05718.18
5.6.120.0130.07021.05
5.6.110.0030.05321.01
5.6.100.0070.05021.00
5.6.90.0030.08721.01
5.6.80.0130.07320.46
5.5.350.0200.04020.50
5.5.340.0100.04717.98
5.5.330.0030.04320.35
5.5.320.0170.04320.38
5.5.310.0300.07020.36
5.5.300.0130.04017.95
5.5.290.0100.05318.07
5.5.280.0030.04320.90
5.5.270.0100.07320.95
5.5.260.0170.07020.81
5.5.250.0100.06020.52
5.5.240.0230.07320.21
5.4.450.0130.05019.30
5.4.440.0200.03719.18
5.4.430.0130.07319.18
5.4.420.0170.06719.48
5.4.410.0100.08019.14
5.4.400.0000.08019.24
5.4.390.0170.03018.98
5.4.380.0000.04319.25
5.4.370.0100.07318.82
5.4.360.0130.08719.24
5.4.350.0070.06318.92
5.4.340.0070.07719.00
5.4.320.0070.05718.92
5.4.310.0100.03719.12
5.4.300.0130.03319.00
5.4.290.0170.06318.87
5.4.280.0070.07319.14
5.4.270.0070.05319.18
5.4.260.0070.04318.98
5.4.250.0100.06019.11
5.4.240.0130.06319.08
5.4.230.0100.07318.85
5.4.220.0100.04319.23
5.4.210.0070.06719.14
5.4.200.0100.06319.23
5.4.190.0230.03719.14
5.4.180.0030.07719.23
5.4.170.0030.08019.19
5.4.160.0130.06019.23
5.4.150.0100.04018.83
5.4.140.0070.04316.45
5.4.130.0000.07716.34
5.4.120.0100.06316.42
5.4.110.0100.05716.44
5.4.100.0030.04316.54
5.4.90.0100.04316.45
5.4.80.0130.06016.42
5.4.70.0000.07016.70
5.4.60.0070.04016.32
5.4.50.0030.07716.39
5.4.40.0070.06716.46
5.4.30.0030.05316.46
5.4.20.0100.04016.26
5.4.10.0070.07016.36
5.4.00.0030.05015.88
5.3.290.0030.05714.62
5.3.280.0030.04714.66
5.3.270.0030.05314.79
5.3.260.0000.07714.69
5.3.250.0070.04014.64
5.3.240.0030.06014.69
5.3.230.0100.04314.79
5.3.220.0030.07714.64
5.3.210.0070.06014.66
5.3.200.0070.04014.74
5.3.190.0100.04014.62
5.3.180.0100.03314.59
5.3.170.0130.04014.60
5.3.160.0070.07014.66
5.3.150.0100.04014.63
5.3.140.0030.06014.73
5.3.130.0070.04714.63
5.3.120.0070.07014.65
5.3.110.0030.04014.66
5.3.100.0070.07014.13
5.3.90.0070.06314.04
5.3.80.0070.06014.21
5.3.70.0070.04714.02
5.3.60.0070.04314.00
5.3.50.0030.06714.02
5.3.40.0070.07714.04
5.3.30.0030.07313.83
5.3.20.0100.05713.62
5.3.10.0070.07013.69
5.3.00.0030.07013.72
5.2.170.0100.05711.19
5.2.160.0070.05311.11
5.2.150.0070.05311.11
5.2.140.0000.05711.21
5.2.130.0030.06711.15
5.2.120.0170.05311.10
5.2.110.0070.04311.19
5.2.100.0070.05711.14
5.2.90.0030.06311.20
5.2.80.0030.03711.29
5.2.70.0100.03011.18
5.2.60.0000.04311.08
5.2.50.0100.06310.95
5.2.40.0030.05711.18
5.2.30.0100.06011.05
5.2.20.0170.04711.00
5.2.10.0100.02710.93
5.2.00.0030.03310.79
5.1.60.0000.04010.07
5.1.50.0000.04710.00
5.1.40.0030.05710.00
5.1.30.0030.05010.40
5.1.20.0170.04310.31
5.1.10.0030.04710.13
5.1.00.0030.05010.07
5.0.50.0070.0438.57
5.0.40.0000.0378.48
5.0.30.0000.0408.31
5.0.20.0030.0378.26
5.0.10.0000.0278.22
5.0.00.0070.0678.19
4.4.90.0070.0178.06
4.4.80.0000.0308.06
4.4.70.0000.0308.06
4.4.60.0030.0308.06
4.4.50.0030.0178.06
4.4.40.0030.0538.06
4.4.30.0030.0338.06
4.4.20.0030.0178.06
4.4.10.0030.0338.06
4.4.00.0030.0508.06
4.3.110.0070.0308.06
4.3.100.0030.0338.06
4.3.90.0000.0378.06
4.3.80.0100.0378.06
4.3.70.0000.0408.06
4.3.60.0000.0178.06
4.3.50.0070.0208.06
4.3.40.0000.0608.06
4.3.30.0000.0178.06
4.3.20.0030.0308.06
4.3.10.0030.0208.06
4.3.00.0000.0308.06

preferences:
34.04 ms | 400 KiB | 5 Q