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, $empty, array $array, TestSampleClass $class, $two = 2, $three = 'three', $string = 'somestring', $null = null, $int = 1, $bool = true, array $arrayOrNull = null, 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.0070.01118.53
8.3.50.0080.00822.05
8.3.40.0120.00418.64
8.3.30.0100.01018.79
8.3.20.0080.00018.91
8.3.10.0000.00821.05
8.3.00.0040.00423.27
8.2.180.0080.01117.00
8.2.170.0070.01122.96
8.2.160.0070.00720.25
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0060.00326.16
8.2.120.0050.00320.93
8.2.110.0080.00320.53
8.2.100.0090.00318.03
8.2.90.0000.00719.30
8.2.80.0000.00818.04
8.2.70.0050.00517.63
8.2.60.0040.00418.05
8.2.50.0050.00318.07
8.2.40.0080.00018.34
8.2.30.0000.00721.11
8.2.20.0080.00017.81
8.2.10.0000.00817.85
8.2.00.0080.00017.71
8.1.280.0080.00825.92
8.1.270.0000.00823.99
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0060.00322.46
8.1.230.0090.00321.02
8.1.220.0000.00818.77
8.1.210.0030.00518.90
8.1.200.0030.00617.25
8.1.190.0040.00417.53
8.1.180.0040.00418.10
8.1.170.0040.00418.71
8.1.160.0040.00418.77
8.1.150.0040.00418.54
8.1.140.0000.00817.48
8.1.130.0000.00817.83
8.1.120.0030.00517.50
8.1.110.0040.00417.47
8.1.100.0000.00717.47
8.1.90.0000.00817.53
8.1.80.0050.00217.52
8.1.70.0000.00717.41
8.1.60.0000.00817.51
8.1.50.0000.00817.52
8.1.40.0000.00817.58
8.1.30.0050.00317.63
8.1.20.0060.00317.75
8.1.10.0040.00417.59
8.1.00.0040.00417.54
8.0.300.0040.00419.89
8.0.290.0000.00717.05
8.0.280.0000.00718.45
8.0.270.0000.00817.34
8.0.260.0040.00416.88
8.0.250.0040.00417.11
8.0.240.0040.00417.12
8.0.230.0040.00417.06
8.0.220.0000.00816.96
8.0.210.0040.00416.96
8.0.200.0000.00716.91
8.0.190.0000.00717.09
8.0.180.0040.00416.97
8.0.170.0060.00317.02
8.0.160.0000.00716.89
8.0.150.0040.00416.84
8.0.140.0000.00716.87
8.0.130.0030.00313.40
8.0.120.0050.00216.89
8.0.110.0040.00416.94
8.0.100.0050.00317.00
8.0.90.0030.00516.89
8.0.80.0030.01216.94
8.0.70.0070.00016.82
8.0.60.0040.00416.96
8.0.50.0050.00216.92
8.0.30.0080.01517.18
8.0.20.0160.00717.40
8.0.10.0040.00416.96
8.0.00.0130.00616.71
7.4.330.0030.00314.81
7.4.320.0070.00316.54
7.4.300.0000.00816.57
7.4.290.0000.00716.54
7.4.280.0000.00716.57
7.4.270.0070.00016.44
7.4.260.0000.00613.26
7.4.250.0040.00416.42
7.4.240.0040.00416.52
7.4.230.0030.00516.33
7.4.220.0100.00716.58
7.4.210.0050.01216.57
7.4.200.0030.00316.63
7.4.190.0040.00416.71
7.4.160.0040.01216.55
7.4.150.0070.01117.40
7.4.140.0090.00917.86
7.4.130.0120.00616.48
7.4.120.0130.00416.54
7.4.110.0030.01516.48
7.4.100.0090.00916.45
7.4.90.0090.01216.50
7.4.80.0100.00819.39
7.4.70.0100.00616.50
7.4.60.0130.00316.54
7.4.50.0000.00816.72
7.4.40.0120.00622.77
7.4.30.0080.00816.43
7.4.00.0080.00614.95
7.3.330.0000.00513.17
7.3.320.0070.00013.16
7.3.310.0030.00316.49
7.3.300.0030.00316.40
7.3.290.0140.00616.39
7.3.280.0080.00716.37
7.3.270.0120.00617.40
7.3.260.0120.00918.24
7.3.250.0110.01016.41
7.3.240.0090.01316.64
7.3.230.0090.00916.64
7.3.210.0070.01116.27
7.3.200.0090.01219.39
7.3.190.0180.00616.35
7.3.180.0110.00616.57
7.3.170.0140.00716.40
7.3.160.0080.00816.44
7.3.120.0110.00714.79
7.3.10.0150.00216.48
7.3.00.0110.00616.59
7.2.330.0110.00716.86
7.2.320.0120.01216.93
7.2.310.0040.01416.69
7.2.300.0030.01416.79
7.2.290.0110.00716.80
7.2.130.0100.00716.64
7.2.120.0130.00516.73
7.2.110.0090.01016.67
7.2.100.0100.00716.78
7.2.90.0120.00816.82
7.2.80.0100.01016.71
7.2.70.0070.01116.84
7.2.60.0100.00616.68
7.2.50.0090.00716.46
7.2.40.0130.00916.83
7.2.30.0160.00616.92
7.2.20.0090.01116.76
7.2.10.0160.00416.73
7.2.00.0100.00717.64
7.1.250.0100.00615.66
7.1.200.0030.00615.97
7.1.100.0060.00618.13
7.1.70.0000.00817.16
7.1.60.0100.01319.40
7.1.50.0040.01817.00
7.1.00.0070.07022.37
7.0.200.0060.00316.86
7.0.140.0030.07722.09
7.0.70.0100.07721.80
7.0.60.0030.05021.82
7.0.50.0300.06722.16
7.0.40.0030.07320.18
7.0.30.0070.06020.03
7.0.20.0030.07720.05
7.0.10.0030.07020.04
7.0.00.0030.08719.95
5.6.280.0070.09721.15
5.6.220.0030.08020.58
5.6.210.0100.08320.50
5.6.200.0070.08720.96
5.6.190.0070.08321.05
5.6.180.0070.06021.08
5.6.170.0000.09020.97
5.6.160.0000.05021.11
5.6.150.0070.07021.11
5.6.140.0000.09021.13
5.6.130.0100.08721.14
5.6.120.0070.06321.12
5.6.110.0030.07320.95
5.6.100.0030.09021.10
5.6.90.0030.08021.11
5.6.80.0030.05320.49
5.6.70.0000.08020.36
5.6.60.0100.07720.40
5.6.50.0030.04720.49
5.6.40.0100.07320.50
5.6.30.0030.07720.36
5.6.20.0030.08320.39
5.6.10.0030.07320.41
5.6.00.0030.08320.37
5.5.360.0070.08020.52
5.5.350.0030.07020.41
5.5.340.0030.09020.65
5.5.330.0170.07720.89
5.5.320.0030.07720.93
5.5.310.0000.08320.95
5.5.300.0100.07320.91
5.5.290.0170.07020.94
5.5.280.0170.07720.89
5.5.270.0100.07720.85
5.5.260.0030.07320.88
5.5.250.0030.05020.66
5.5.240.0030.05020.30
5.5.230.0070.06320.13
5.5.220.0070.07720.29
5.5.210.0030.08320.31
5.5.200.0030.06320.14
5.5.190.0030.05720.11
5.5.180.0170.06720.25
5.5.160.0000.06020.02
5.5.150.0070.07720.24
5.5.140.0070.07720.25
5.5.130.0000.08320.13
5.5.120.0070.07720.14
5.5.110.0070.08020.28
5.5.100.0000.05720.10
5.5.90.0100.07720.12
5.5.80.0070.07320.19
5.5.70.0200.06020.08
5.5.60.0030.07319.96
5.5.50.0100.07320.14
5.5.40.0070.07020.05
5.5.30.0000.05719.98
5.5.20.0030.04720.13
5.5.10.0030.03720.14
5.5.00.0030.08020.14
5.4.450.0000.05719.45
5.4.440.0030.08019.45
5.4.430.0130.07019.37
5.4.420.0070.05019.44
5.4.410.0070.07019.24
5.4.400.0000.07718.85
5.4.390.0000.07719.09
5.4.380.0000.08018.82
5.4.370.0070.05019.03
5.4.360.0030.07319.04
5.4.350.0000.06319.14
5.4.340.0100.07018.95
5.4.320.0070.07019.09
5.4.310.0070.06018.88
5.4.300.0070.07018.84
5.4.290.0030.07718.89
5.4.280.0030.06018.91
5.4.270.0070.07019.13
5.4.260.0070.07319.12
5.4.250.0000.08019.12
5.4.240.0030.07719.24
5.4.230.0030.07718.96
5.4.220.0070.07019.03
5.4.210.0070.06718.84
5.4.200.0000.08019.20
5.4.190.0000.08718.84
5.4.180.0070.03719.13
5.4.170.0100.06318.90
5.4.160.0100.07319.10
5.4.150.0030.07719.18
5.4.140.0100.07016.52
5.4.130.0030.07716.51
5.4.120.0030.04316.51
5.4.110.0070.07016.54
5.4.100.0000.05316.37
5.4.90.0000.08016.43
5.4.80.0030.06716.36
5.4.70.0030.07316.38
5.4.60.0030.07016.48
5.4.50.0070.05716.40
5.4.40.0000.08016.29
5.4.30.0100.05316.41
5.4.20.0070.07016.27
5.4.10.0070.07316.42
5.4.00.0030.07315.81
5.3.290.0070.08014.65
5.3.280.0000.04714.55
5.3.270.0000.06014.70
5.3.260.0030.08014.76
5.3.250.0030.06714.76
5.3.240.0000.07714.73
5.3.230.0070.07314.57
5.3.220.0030.04714.59
5.3.210.0030.08014.66
5.3.200.0030.08014.62
5.3.190.0100.06314.70
5.3.180.0070.07314.54
5.3.170.0000.07714.74
5.3.160.0030.06714.53
5.3.150.0030.05714.57
5.3.140.0030.06314.65
5.3.130.0100.06314.73
5.3.120.0000.06014.64
5.3.110.0070.08014.53
5.3.100.0030.07314.14
5.3.90.0070.07014.04
5.3.80.0030.07714.08
5.3.70.0000.07314.11
5.3.60.0030.05013.94
5.3.50.0030.07013.97
5.3.40.0030.07714.00
5.3.30.0030.06314.08
5.3.20.0000.08013.83
5.3.10.0070.06313.68
5.3.00.0030.07313.60
5.2.170.0030.06311.05
5.2.160.0000.05311.21
5.2.150.0000.06711.21
5.2.140.0030.07011.32
5.2.130.0030.06311.23
5.2.120.0000.04711.21
5.2.110.0030.04311.13
5.2.100.0000.06711.05
5.2.90.0100.05711.00
5.2.80.0030.06711.20
5.2.70.0070.06311.20
5.2.60.0070.05711.11
5.2.50.0070.06010.99
5.2.40.0030.05310.96
5.2.30.0070.06011.14
5.2.20.0000.06311.09
5.2.10.0030.06010.96
5.2.00.0070.05310.96
5.1.60.0100.03310.96
5.1.50.0030.04310.96
5.1.40.0030.05010.96
5.1.30.0070.05710.96
5.1.20.0030.05010.96
5.1.10.0030.05010.96
5.1.00.0030.04710.96
5.0.50.0030.03710.96
5.0.40.0070.03710.96
5.0.30.0100.03310.96
5.0.20.0030.03710.96
5.0.10.0030.04310.96
5.0.00.0000.05310.96
4.4.90.0030.02710.96
4.4.80.0030.02710.96
4.4.70.0030.03310.96
4.4.60.0030.03710.96
4.4.50.0070.03010.96
4.4.40.0070.04310.96
4.4.30.0070.03010.96
4.4.20.0000.03710.96
4.4.10.0000.02310.96
4.4.00.0000.05710.96
4.3.110.0000.02710.96
4.3.100.0000.03310.96
4.3.90.0000.03010.96
4.3.80.0000.05310.96
4.3.70.0030.03310.96
4.3.60.0000.03710.96
4.3.50.0000.03710.96
4.3.40.0000.05710.96
4.3.30.0030.03010.96
4.3.20.0030.03710.96
4.3.10.0000.03310.96
4.3.00.0030.03710.96

preferences:
48.63 ms | 401 KiB | 5 Q