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 ReflectionClass($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 = null) { return 'mixedValue'; } } $tests = array( // array('one', 'int'), // array('two', 'int'), array('one', null), array('two', null), // 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.0060.01018.65
8.3.50.0150.00422.12
8.3.40.0110.00418.67
8.3.30.0040.01119.21
8.3.20.0000.00820.34
8.3.10.0050.00323.53
8.3.00.0040.00419.21
8.2.180.0040.01518.29
8.2.170.0140.00022.96
8.2.160.0130.00320.52
8.2.150.0050.00224.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0000.00820.85
8.2.110.0030.00622.16
8.2.100.0090.00319.64
8.2.90.0050.00319.20
8.2.80.0000.00917.97
8.2.70.0050.00317.75
8.2.60.0100.00018.05
8.2.50.0040.00418.07
8.2.40.0040.00421.11
8.2.30.0050.00218.43
8.2.20.0000.00917.82
8.2.10.0080.00018.17
8.2.00.0080.00017.76
8.1.280.0060.01225.92
8.1.270.0030.00623.80
8.1.260.0090.00026.35
8.1.250.0050.00228.09
8.1.240.0090.00023.85
8.1.230.0110.00019.01
8.1.220.0060.00317.78
8.1.210.0040.00418.77
8.1.200.0080.00317.35
8.1.190.0050.00317.23
8.1.180.0060.00318.10
8.1.170.0040.00418.53
8.1.160.0000.00821.98
8.1.150.0000.00718.55
8.1.140.0000.00917.34
8.1.130.0000.00817.83
8.1.120.0050.00217.49
8.1.110.0000.00717.51
8.1.100.0040.00417.38
8.1.90.0040.00417.48
8.1.80.0040.00417.36
8.1.70.0000.01017.40
8.1.60.0030.00617.61
8.1.50.0000.00817.47
8.1.40.0000.00817.56
8.1.30.0000.00817.50
8.1.20.0040.00417.61
8.1.10.0040.00417.46
8.1.00.0030.00617.45
8.0.300.0040.00418.77
8.0.290.0060.00317.05
8.0.280.0000.00718.45
8.0.270.0000.00817.26
8.0.260.0000.00817.35
8.0.250.0000.00717.05
8.0.240.0080.00016.93
8.0.230.0040.00416.88
8.0.220.0030.00516.90
8.0.210.0030.00317.01
8.0.200.0070.00016.91
8.0.190.0090.00016.90
8.0.180.0000.00716.93
8.0.170.0050.00217.05
8.0.160.0000.00817.04
8.0.150.0070.00016.95
8.0.140.0000.00716.81
8.0.130.0000.00613.33
8.0.120.0070.00016.90
8.0.110.0040.00417.01
8.0.100.0070.00016.88
8.0.90.0000.00816.98
8.0.80.0080.00816.95
8.0.70.0000.00716.80
8.0.60.0050.00316.77
8.0.50.0030.00516.91
8.0.30.0120.00917.11
8.0.20.0140.00617.40
8.0.10.0040.00416.96
8.0.00.0100.00716.63
7.4.330.0070.00015.00
7.4.320.0060.00316.57
7.4.300.0000.00616.56
7.4.290.0050.00216.62
7.4.280.0040.00416.62
7.4.270.0040.00416.61
7.4.260.0040.00416.59
7.4.250.0000.00716.38
7.4.240.0020.00616.49
7.4.230.0070.00016.55
7.4.220.0090.01216.47
7.4.210.0090.00516.66
7.4.200.0040.00416.71
7.4.190.0000.00716.33
7.4.160.0100.00716.45
7.4.150.0140.00717.40
7.4.140.0110.00617.86
7.4.130.0060.01116.54
7.4.120.0100.00816.58
7.4.110.0030.01316.48
7.4.100.0070.01116.29
7.4.90.0060.01216.58
7.4.80.0030.01319.39
7.4.70.0060.01116.66
7.4.60.0090.01216.34
7.4.50.0040.00016.43
7.4.40.0030.01616.47
7.4.30.0030.01316.42
7.4.00.0030.01015.12
7.3.330.0030.00313.21
7.3.320.0030.00313.38
7.3.310.0000.00716.28
7.3.300.0050.00216.38
7.3.290.0040.01116.39
7.3.280.0110.01016.34
7.3.270.0060.01017.40
7.3.260.0160.00416.37
7.3.250.0150.00316.63
7.3.240.0110.00816.60
7.3.230.0030.01316.57
7.3.210.0100.01316.68
7.3.200.0060.01119.39
7.3.190.0050.01516.66
7.3.180.0000.01516.31
7.3.170.0030.02016.49
7.3.160.0070.01016.51
7.3.120.0090.00614.88
7.3.10.0040.00416.44
7.3.00.0060.00616.66
7.2.330.0060.01516.74
7.2.320.0130.00316.89
7.2.310.0070.01016.91
7.2.300.0100.01316.79
7.2.290.0180.00016.73
7.2.130.0030.00716.62
7.2.120.0000.01316.53
7.2.110.0030.00817.04
7.2.100.0030.00916.96
7.2.90.0000.01416.78
7.2.80.0090.00016.48
7.2.70.0040.00716.71
7.2.60.0030.00716.59
7.2.50.0060.00916.55
7.2.40.0030.01216.49
7.2.30.0030.01216.64
7.2.20.0040.00416.47
7.2.10.0040.00716.75
7.2.00.0090.00316.85
7.1.250.0000.01015.46
7.1.100.0000.01218.24
7.1.70.0040.00417.15
7.1.60.0100.01719.46
7.1.50.0080.00417.01
7.1.00.0100.07022.37
7.0.200.0030.01016.83
7.0.140.0030.07322.07
7.0.60.0070.06719.97
7.0.50.0070.08017.89
7.0.40.0070.08317.73
7.0.30.0130.06317.72
7.0.20.0000.06717.75
7.0.10.0100.05017.73
7.0.00.0130.08017.76
5.6.280.0000.07721.10
5.6.210.0000.09020.49
5.6.200.0000.07318.19
5.6.190.0100.06018.11
5.6.180.0000.04318.19
5.6.170.0130.07718.17
5.6.160.0130.05718.18
5.6.150.0100.07718.25
5.6.140.0100.04318.16
5.6.130.0070.06018.16
5.6.120.0000.09718.25
5.6.110.0030.09018.26
5.6.100.0100.05718.23
5.6.90.0030.06318.16
5.6.80.0070.08017.57
5.6.70.0070.04717.66
5.6.60.0030.05717.66
5.6.50.0070.06717.63
5.6.40.0100.03717.57
5.6.30.0070.04717.55
5.6.20.0070.07717.60
5.6.10.0030.06017.59
5.6.00.0030.06017.63
5.5.350.4170.04320.52
5.5.340.0130.05318.05
5.5.330.0070.06017.97
5.5.320.0130.07717.99
5.5.310.0200.07017.98
5.5.300.0070.04317.98
5.5.290.0070.04017.99
5.5.280.0070.04717.99
5.5.270.0030.06317.98
5.5.260.0000.06017.95
5.5.250.0030.07317.78
5.5.240.0000.06017.40
5.5.230.0100.06717.37
5.5.220.0070.07717.42
5.5.210.0100.06317.39
5.5.200.0000.08017.43
5.5.190.0100.07317.34
5.5.180.0070.05017.49
5.5.160.0070.07317.37
5.5.150.0030.04017.29
5.5.140.0100.03717.30
5.5.130.0100.07017.41
5.5.120.0130.07017.37
5.5.110.0100.07317.43
5.5.100.0100.07017.20
5.5.90.0130.07317.22
5.5.80.0100.07317.23
5.5.70.0030.05717.23
5.5.60.0030.04717.21
5.5.50.0000.07017.20
5.5.40.0030.05017.32
5.5.30.0030.04017.28
5.5.20.0030.08317.22
5.5.10.0030.04017.32
5.5.00.0070.08317.22
5.4.450.0000.04319.22
5.4.440.0070.08319.30
5.4.430.0100.07319.41
5.4.420.0100.07719.34
5.4.410.0200.06319.21
5.4.400.0070.08019.02
5.4.390.0070.08319.13
5.4.380.0100.07319.00
5.4.370.0130.07018.88
5.4.360.0030.04019.11
5.4.350.0030.06719.27
5.4.340.0070.07019.04
5.4.320.0070.06318.97
5.4.310.0000.05019.05
5.4.300.0000.04019.12
5.4.290.0070.04019.05
5.4.280.0170.07019.27
5.4.270.0100.07019.09
5.4.260.0200.06319.09
5.4.250.0100.07718.94
5.4.240.0000.08319.09
5.4.230.0170.07019.02
5.4.220.0100.04019.04
5.4.210.0070.07719.00
5.4.200.0030.04719.02
5.4.190.0030.04318.94
5.4.180.0030.07719.09
5.4.170.0000.06319.00
5.4.160.0100.05019.02
5.4.150.0030.08319.10
5.4.140.0070.07316.45
5.4.130.0030.06016.48
5.4.120.0000.08016.48
5.4.110.0100.05316.43
5.4.100.0100.07016.43
5.4.90.0100.06716.64
5.4.80.0070.04316.62
5.4.70.0000.04316.46
5.4.60.0100.07016.23
5.4.50.0070.07016.38
5.4.40.0070.03316.44
5.4.30.0070.03316.28
5.4.20.0100.06316.45
5.4.10.0070.07316.23
5.4.00.0030.05015.75
5.3.290.0030.08014.70
5.3.280.0070.04014.66
5.3.270.0030.07014.73
5.3.260.0070.06314.48
5.3.250.0070.04314.68
5.3.240.0000.08014.63
5.3.230.0070.04314.72
5.3.220.0070.05714.62
5.3.210.0130.05714.61
5.3.200.0070.04714.68
5.3.190.0070.06014.61
5.3.180.0130.04014.61
5.3.170.0130.03014.54
5.3.160.0070.04314.64
5.3.150.0070.07014.60
5.3.140.0030.04714.60
5.3.130.0070.03714.52
5.3.120.0170.06014.63
5.3.110.0100.03714.59
5.3.100.0030.08014.16
5.3.90.0070.07714.06
5.3.80.0100.05314.07
5.3.70.0070.04014.07
5.3.60.0170.06714.08
5.3.50.0070.05013.87
5.3.40.0070.04713.99
5.3.30.0030.07314.01
5.3.20.0070.07013.76
5.3.10.0130.04313.56
5.3.00.0070.06313.71
5.2.170.0030.03311.21
5.2.160.0000.03311.21
5.2.150.0030.06011.27
5.2.140.0070.06011.26
5.2.130.0100.06011.20
5.2.120.0130.05011.09
5.2.110.0000.03311.18
5.2.100.0100.05711.20
5.2.90.0070.03711.17
5.2.80.0030.03011.02
5.2.70.0030.03711.14
5.2.60.0000.04311.08
5.2.50.0070.03311.02
5.2.40.0000.03711.07
5.2.30.0100.05711.10
5.2.20.0100.02310.98
5.2.10.0000.04310.90
5.2.00.0130.05010.80
5.1.60.0070.0509.99
5.1.50.0030.04710.01
5.1.40.0100.04710.10
5.1.30.0000.06310.33
5.1.20.0070.05710.40
5.1.10.0100.03310.08
5.1.00.0070.03710.13
5.0.50.0000.0339.07
5.0.40.0000.0509.07
5.0.30.0030.0709.07
5.0.20.0000.0239.07
5.0.10.0000.0479.07
5.0.00.0000.0609.07
4.4.90.0000.0309.07
4.4.80.0030.0279.07
4.4.70.0000.0379.07
4.4.60.0070.0279.07
4.4.50.0070.0209.07
4.4.40.0030.0439.07
4.4.30.0030.0309.07
4.4.20.0000.0409.07
4.4.10.0030.0309.07
4.4.00.0000.0379.07
4.3.110.0000.0339.07
4.3.100.0000.0239.07
4.3.90.0030.0179.07
4.3.80.0030.0539.07
4.3.70.0030.0209.07
4.3.60.0070.0279.07
4.3.50.0000.0379.07
4.3.40.0000.0579.07
4.3.30.0000.0339.07
4.3.20.0000.0379.07
4.3.10.0000.0279.07
4.3.00.0000.0239.07

preferences:
40.56 ms | 401 KiB | 5 Q