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 = null) { return 'mixedValue'; } } $tests = array( array('one', null), array('two', 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.0100.00616.63
8.3.50.0080.01316.62
8.3.40.0090.00618.71
8.3.30.0120.00318.79
8.3.20.0030.00618.90
8.3.10.0030.00618.77
8.3.00.0060.00319.63
8.2.180.0060.01018.41
8.2.170.0040.01122.96
8.2.160.0060.00919.08
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0070.00020.93
8.2.110.0090.00022.07
8.2.100.0120.00017.97
8.2.90.0060.00318.07
8.2.80.0060.00318.92
8.2.70.0080.00017.50
8.2.60.0040.00418.05
8.2.50.0040.00418.07
8.2.40.0000.00818.16
8.2.30.0000.00718.09
8.2.20.0080.00317.82
8.2.10.0040.00417.85
8.2.00.0000.00817.78
8.1.280.0000.01425.92
8.1.270.0040.00423.99
8.1.260.0080.00026.35
8.1.250.0030.00628.09
8.1.240.0060.00323.79
8.1.230.0090.00319.29
8.1.220.0050.00317.79
8.1.210.0050.00318.77
8.1.200.0070.00317.35
8.1.190.0030.00617.23
8.1.180.0060.00318.10
8.1.170.0040.00418.52
8.1.160.0070.00018.96
8.1.150.0000.00718.80
8.1.140.0080.00017.53
8.1.130.0030.00317.43
8.1.120.0040.00417.49
8.1.110.0040.00417.48
8.1.100.0000.00717.40
8.1.90.0020.00517.43
8.1.80.0000.00717.50
8.1.70.0070.00017.45
8.1.60.0060.00317.66
8.1.50.0050.00317.36
8.1.40.0000.00917.52
8.1.30.0040.00417.50
8.1.20.0040.00417.73
8.1.10.0030.00617.54
8.1.00.0000.00817.53
8.0.300.0070.00018.77
8.0.290.0030.00616.75
8.0.280.0000.00818.47
8.0.270.0070.00017.34
8.0.260.0030.00316.78
8.0.250.0070.00017.00
8.0.240.0000.00717.04
8.0.230.0000.00716.91
8.0.220.0090.00316.99
8.0.210.0040.00416.89
8.0.200.0050.00217.02
8.0.190.0050.00317.04
8.0.180.0100.00016.93
8.0.170.0040.00416.93
8.0.160.0070.00017.02
8.0.150.0060.00316.90
8.0.140.0030.00616.83
8.0.130.0030.00313.33
8.0.120.0080.00016.86
8.0.110.0040.00416.79
8.0.100.0040.00417.01
8.0.90.0070.00016.99
8.0.80.0060.00917.02
8.0.70.0040.00416.87
8.0.60.0060.00316.79
8.0.50.0060.00317.04
8.0.30.0100.01017.30
8.0.20.0050.01417.24
8.0.10.0040.00417.11
8.0.00.0110.00716.87
7.4.330.0000.00512.99
7.4.320.0000.00716.63
7.4.300.0060.00016.52
7.4.290.0030.00516.53
7.4.280.0040.00416.54
7.4.270.0000.00716.48
7.4.260.0050.00013.19
7.4.250.0060.00316.52
7.4.240.0000.00716.57
7.4.230.0080.00316.41
7.4.220.0110.01416.68
7.4.210.0120.00316.57
7.4.200.0060.00316.70
7.4.190.0000.00816.48
7.4.160.0070.01016.66
7.4.150.0130.01016.66
7.4.140.0170.00616.70
7.4.130.0070.01116.67
7.4.120.0060.01016.56
7.4.110.0150.00316.68
7.4.100.0120.01216.61
7.4.90.0130.01316.71
7.4.80.0030.01619.39
7.4.70.0090.00916.52
7.4.60.0030.01316.52
7.4.50.0030.00316.43
7.4.40.0060.00916.55
7.4.30.0030.01316.70
7.4.00.0080.00514.98
7.3.330.0060.00013.29
7.3.320.0030.00313.44
7.3.310.0070.00016.43
7.3.300.0000.00616.49
7.3.290.0100.00616.34
7.3.280.0100.00516.46
7.3.270.0120.00416.62
7.3.260.0160.00716.44
7.3.250.0130.00416.54
7.3.240.0030.01816.74
7.3.230.0050.01116.58
7.3.210.0120.00616.43
7.3.200.0100.00716.74
7.3.190.0140.00616.49
7.3.180.0070.01016.38
7.3.170.0060.01016.59
7.3.160.0140.00416.50
7.3.120.0060.01014.85
7.3.110.0070.01114.88
7.3.100.0030.01214.85
7.3.90.0030.01314.82
7.3.80.0060.00614.93
7.3.70.0060.00915.05
7.3.60.0080.00014.82
7.3.50.0080.00414.99
7.3.40.0070.01114.94
7.3.30.0100.00014.99
7.3.20.0000.01516.71
7.3.10.0000.01016.89
7.3.00.0070.00716.68
7.2.330.0110.00616.89
7.2.320.0070.01116.79
7.2.310.0200.00316.76
7.2.300.0140.00616.74
7.2.290.0090.01516.83
7.2.250.0100.00715.13
7.2.240.0030.01714.99
7.2.230.0110.00415.07
7.2.220.0100.00714.97
7.2.210.0030.01015.04
7.2.200.0060.00915.20
7.2.190.0140.00315.32
7.2.180.0040.00815.21
7.2.170.0140.00014.96
7.2.60.0890.00915.12
7.2.00.0060.01019.19
7.1.330.0070.00715.98
7.1.320.0060.00615.80
7.1.310.0120.00015.89
7.1.300.0040.00715.79
7.1.290.0090.00615.87
7.1.280.0090.00915.64
7.1.270.0090.00815.31
7.1.260.0030.00615.80
7.1.200.0060.00915.71
7.1.100.0000.00918.30
7.1.70.0000.00817.28
7.1.60.0140.01019.30
7.1.50.0070.01716.71
7.1.00.0030.06022.37
7.0.200.0040.00416.78
7.0.140.0070.07022.08
7.0.120.0000.07022.15
7.0.60.0070.08020.02
7.0.50.0070.08017.95
7.0.40.0030.05020.25
7.0.30.0170.04320.17
7.0.20.0200.04320.13
7.0.10.0100.05020.33
7.0.00.0100.08320.18
5.6.280.0030.07321.18
5.6.210.0070.03720.77
5.6.200.0100.05718.17
5.6.190.0000.07020.61
5.6.180.0370.07720.38
5.6.170.0370.08720.55
5.6.160.0030.04720.50
5.6.150.0030.07718.15
5.6.140.0130.07718.21
5.6.130.0000.06318.18
5.6.120.0130.08021.16
5.6.110.0100.09321.06
5.6.100.0100.08720.97
5.6.90.0130.07721.10
5.6.80.0170.06320.43
5.6.70.0170.04020.50
5.5.350.0370.07720.36
5.5.340.0030.08318.07
5.5.330.0100.08720.28
5.5.320.0300.07320.33
5.5.310.0370.08020.28
5.5.300.0030.04018.07
5.5.290.0170.07018.08
5.5.280.0030.09020.68
5.5.270.0130.08020.89
5.5.260.0070.07320.81
5.5.250.0130.07720.70
5.5.240.0100.06720.30
5.4.450.0030.05019.20
5.4.440.0170.07719.46
5.4.430.0070.08319.18
5.4.420.0130.07319.32
5.4.410.0070.07719.12
5.4.400.0130.07318.86
5.4.390.0070.07018.85
5.4.380.0000.07318.98
5.4.370.0130.05319.14
5.4.360.0100.06718.85
5.4.350.0000.08019.24
5.4.340.0030.05319.15
5.4.320.0030.04019.23
5.4.310.0070.05719.24
5.4.300.0070.08019.14
5.4.290.0100.03319.24
5.4.280.0000.06319.09
5.4.270.0100.07019.24
5.4.260.0030.08018.85
5.4.250.0170.05719.23
5.4.240.0070.04018.92
5.4.230.0070.04019.23
5.4.220.0070.05019.14
5.4.210.0000.05019.15
5.4.200.0130.05719.23
5.4.190.0030.05318.93
5.4.180.0070.06718.91
5.4.170.0130.07019.13
5.4.160.0230.07019.13
5.4.150.0030.07718.96
5.4.140.0070.07716.43
5.4.130.0130.03016.43
5.4.120.0100.03716.35
5.4.110.0030.04316.36
5.4.100.0100.07316.46
5.4.90.0070.05716.52
5.4.80.0000.06716.31
5.4.70.0030.06016.43
5.4.60.0070.04016.37
5.4.50.0100.07316.52
5.4.40.0030.07016.64
5.4.30.0100.06716.36
5.4.20.0130.07016.40
5.4.10.0070.07316.40
5.4.00.0100.07015.75
5.3.290.0000.04714.73
5.3.280.0070.07714.64
5.3.270.0030.07714.64
5.3.260.0030.08314.67
5.3.250.0200.05714.69
5.3.240.0170.07014.53
5.3.230.0070.08014.55
5.3.220.0070.07714.52
5.3.210.0070.04014.75
5.3.200.0000.04314.75
5.3.190.0000.05314.64
5.3.180.0030.04014.61
5.3.170.0030.08314.48
5.3.160.0130.04714.60
5.3.150.0030.04714.48
5.3.140.0070.04714.61
5.3.130.0070.06014.58
5.3.120.0070.04014.59
5.3.110.0030.07714.66
5.3.100.0100.07314.12
5.3.90.0100.07014.06
5.3.80.0030.07714.10
5.3.70.0130.07014.06
5.3.60.0030.07714.12
5.3.50.0030.05714.01
5.3.40.0030.07314.03
5.3.30.0030.07313.94
5.3.20.0030.07713.88
5.3.10.0100.04013.84
5.3.00.0070.06013.84
5.2.170.0030.06311.23
5.2.160.0070.03311.18
5.2.150.0100.05711.34
5.2.140.0030.05311.09
5.2.130.0070.06311.02
5.2.120.0070.05711.06
5.2.110.0070.04711.10
5.2.100.0030.05311.14
5.2.90.0030.05711.29
5.2.80.0030.05011.18
5.2.70.0000.04011.01
5.2.60.0000.03011.14
5.2.50.0070.03011.09
5.2.40.0030.03311.10
5.2.30.0000.03010.89
5.2.20.0030.02711.04
5.2.10.0030.02710.81
5.2.00.0030.03010.76
5.1.60.0070.02010.18
5.1.50.0000.0279.98
5.1.40.0000.02310.06
5.1.30.0070.02010.42
5.1.20.0000.02710.40
5.1.10.0030.02310.25
5.1.00.0100.03710.24
5.0.50.0000.0208.49
5.0.40.0000.0208.52
5.0.30.0000.0308.17
5.0.20.0000.0208.23
5.0.10.0030.0178.27
5.0.00.0030.0278.24
4.4.90.0030.0307.80
4.4.80.0000.0177.80
4.4.70.0070.0107.80
4.4.60.0000.0177.80
4.4.50.0100.0077.80
4.4.40.0000.0237.80
4.4.30.0000.0177.80
4.4.20.0000.0177.80
4.4.10.0000.0177.80
4.4.00.0000.0307.80
4.3.110.0030.0107.80
4.3.100.0000.0137.80
4.3.90.0000.0177.80
4.3.80.0000.0237.80
4.3.70.0000.0137.80
4.3.60.0000.0137.80
4.3.50.0000.0177.80
4.3.40.0000.0277.80
4.3.30.0000.0137.80
4.3.20.0000.0137.80
4.3.10.0000.0177.80
4.3.00.0000.0137.80

preferences:
49.65 ms | 404 KiB | 6 Q