3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TestSampleClass { } class MethodReflection extends ReflectionMethod { protected $annotations = null; public function getDocBlock() { if ('' == $this->getDocComment()) { return false; } $instance = new DocBlockReflection($this); return $instance; } public function getAnnotations(AnnotationManager $annotationManager) { if (($docComment = $this->getDocComment()) == '') { return false; } if (!$this->annotations) { $cachingFileScanner = new CachingFileScanner($this->getFileName()); $nameInformation = $cachingFileScanner->getClassNameInformation($this->getDeclaringClass()->getName()); $this->annotations = new AnnotationScanner($annotationManager, $docComment, $nameInformation); } return $this->annotations; } public function getDeclaringClass() { $phpReflection = parent::getDeclaringClass(); $zendReflection = new ClassReflection($phpReflection->getName()); unset($phpReflection); return $zendReflection; } public function getParameters() { $phpReflections = parent::getParameters(); $zendReflections = array(); while ($phpReflections && ($phpReflection = array_shift($phpReflections))) { $instance = new ParameterReflection(array($this->getDeclaringClass()->getName(), $this->getName()), $phpReflection->getName()); $zendReflections[] = $instance; unset($phpReflection); } unset($phpReflections); return $zendReflections; } } 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 MethodReflection($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; } }*/ if ($this->isDefaultValueAvailable() && $checkDefault) { if ($type === null) { $value = $this->getDefaultValue(); $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.60.0080.00816.63
8.3.50.0090.00821.96
8.3.40.0080.00819.09
8.3.30.0070.01119.21
8.3.20.0000.00820.25
8.3.10.0030.00523.61
8.3.00.0050.00319.25
8.2.180.0090.00618.29
8.2.170.0040.01222.96
8.2.160.0120.00320.35
8.2.150.0060.00324.18
8.2.140.0040.00424.66
8.2.130.0030.00526.16
8.2.120.0040.00422.32
8.2.110.0090.00022.12
8.2.100.0090.00318.03
8.2.90.0050.00319.40
8.2.80.0060.00317.97
8.2.70.0030.00517.63
8.2.60.0000.00918.14
8.2.50.0060.00318.07
8.2.40.0000.00918.34
8.2.30.0080.00018.07
8.2.20.0040.00417.86
8.2.10.0000.00818.09
8.2.00.0050.00717.79
8.1.280.0040.01425.92
8.1.270.0050.00323.96
8.1.260.0030.00526.35
8.1.250.0080.00028.09
8.1.240.0060.00322.16
8.1.230.0110.00017.96
8.1.220.0050.00317.91
8.1.210.0050.00318.77
8.1.200.0070.00317.36
8.1.190.0080.00017.66
8.1.180.0060.00318.10
8.1.170.0000.00818.73
8.1.160.0040.00421.99
8.1.150.0070.00018.63
8.1.140.0030.00617.43
8.1.130.0000.00718.00
8.1.120.0000.00817.46
8.1.110.0050.00317.43
8.1.100.0000.00817.51
8.1.90.0000.00817.50
8.1.80.0000.00717.50
8.1.70.0070.00017.45
8.1.60.0000.01017.68
8.1.50.0040.00417.47
8.1.40.0040.00417.54
8.1.30.0040.00417.55
8.1.20.0040.00417.70
8.1.10.0040.00417.53
8.1.00.0040.00417.55
8.0.300.0080.00018.77
8.0.290.0030.00617.04
8.0.280.0000.00718.43
8.0.270.0030.00517.30
8.0.260.0080.00017.22
8.0.250.0030.00317.06
8.0.240.0060.00317.12
8.0.230.0030.00517.06
8.0.220.0050.00216.97
8.0.210.0000.00717.00
8.0.200.0000.00716.94
8.0.190.0000.00717.05
8.0.180.0000.00717.08
8.0.170.0090.00017.02
8.0.160.0020.00517.00
8.0.150.0060.00317.02
8.0.140.0030.00617.00
8.0.130.0070.00013.43
8.0.120.0030.00517.00
8.0.110.0030.00516.97
8.0.100.0080.00016.91
8.0.90.0070.00017.03
8.0.80.0060.00917.02
8.0.70.0000.00816.97
8.0.60.0050.00316.84
8.0.50.0000.00817.05
8.0.30.0080.01317.09
8.0.20.0130.01017.40
8.0.10.0070.00017.08
8.0.00.0110.00916.79
7.4.330.0050.00015.00
7.4.320.0030.00316.48
7.4.300.0040.00416.57
7.4.290.0000.00716.64
7.4.280.0080.00016.45
7.4.270.0030.00316.55
7.4.260.0000.00816.65
7.4.250.0040.00416.59
7.4.240.0050.00316.61
7.4.230.0000.00716.46
7.4.220.0140.01416.59
7.4.210.0060.00916.64
7.4.200.0000.00716.53
7.4.190.0000.00816.45
7.4.160.0080.00816.43
7.4.150.0130.00717.40
7.4.140.0120.00917.86
7.4.130.0090.00816.57
7.4.120.0080.01016.69
7.4.110.0000.01816.45
7.4.100.0030.01416.77
7.4.90.0090.00916.50
7.4.80.0170.00319.39
7.4.70.0160.00016.59
7.4.60.0090.01216.53
7.4.50.0030.00516.43
7.4.40.0130.00022.77
7.4.30.0050.01116.46
7.4.00.0030.01215.14
7.3.330.0000.00613.47
7.3.320.0000.00613.32
7.3.310.0040.00416.37
7.3.300.0000.00716.51
7.3.290.0130.00316.49
7.3.280.0090.01316.48
7.3.270.0090.00917.40
7.3.260.0140.00316.51
7.3.250.0130.00516.48
7.3.240.0090.01516.55
7.3.230.0100.01016.47
7.3.210.0030.01316.72
7.3.200.0130.00919.39
7.3.190.0090.00916.46
7.3.180.0140.00416.45
7.3.170.0110.00616.49
7.3.160.0030.01316.43
7.3.120.0100.00714.68
7.2.330.0150.00316.88
7.2.320.0150.01216.86
7.2.310.0120.01216.57
7.2.300.0060.01516.53
7.2.290.0110.01116.82
7.2.60.0070.00717.21
7.2.00.0030.00619.43
7.1.200.0080.00815.98
7.1.100.0040.01118.28
7.1.70.0000.00817.04
7.1.60.0060.01019.33
7.1.50.0070.01016.99
7.1.00.0030.07722.27
7.0.200.0160.00314.78
7.0.140.0070.06322.10
7.0.60.0130.07720.10
7.0.50.0100.06317.97
7.0.40.0070.08720.30
7.0.30.0330.05720.23
7.0.20.0270.07320.26
7.0.10.0030.09020.16
7.0.00.0070.07020.12
5.6.280.0100.07020.82
5.6.210.0130.06320.60
5.6.200.0000.04318.23
5.6.190.0030.07720.55
5.6.180.0230.07020.48
5.6.170.0300.05320.71
5.6.160.0070.06020.52
5.6.150.0070.08018.25
5.6.140.0100.07018.21
5.6.130.0030.04718.20
5.6.120.0070.05721.10
5.6.110.0070.07021.03
5.6.100.0070.05321.01
5.6.90.0030.04021.02
5.6.80.0130.05020.42
5.5.350.0070.04320.44
5.5.340.0100.03317.97
5.5.330.0070.05020.27
5.5.320.0330.07320.29
5.5.310.0270.06020.34
5.5.300.0030.06718.06
5.5.290.0030.06018.02
5.5.280.0030.08321.04
5.5.270.0070.04320.82
5.5.260.0100.05020.91
5.5.250.0070.04720.64
5.5.240.0100.07320.24
5.4.450.0230.04319.41
5.4.440.0270.07019.61
5.4.430.0230.03719.46
5.4.420.0200.06319.54
5.4.410.0330.04019.44
5.4.400.0270.04319.15
5.4.390.0200.07719.31
5.4.380.0200.06718.98
5.4.370.0300.05719.09
5.4.360.0200.08018.99
5.4.350.0170.08019.25
5.4.340.0400.06019.15
5.4.320.0170.06019.20
5.4.310.0270.06319.20
5.4.300.0200.06719.08
5.4.290.0270.07319.05
5.4.280.0100.05018.98
5.4.270.0200.07318.86
5.4.260.0270.05019.24
5.4.250.0330.06018.98
5.4.240.0300.05719.18
5.4.230.0330.04319.31
5.4.220.0170.04718.93
5.4.210.0300.04018.99
5.4.200.0170.04018.94
5.4.190.0200.03319.20
5.4.180.0130.04019.21
5.4.170.0130.03719.07
5.4.160.0200.03019.05
5.4.150.0170.04318.85
5.4.140.0200.04316.34
5.4.130.0070.04016.50
5.4.120.0070.04016.46
5.4.110.0200.03016.59
5.4.100.0170.07716.59
5.4.90.0130.04316.32
5.4.80.0170.03316.56
5.4.70.0130.03716.22
5.4.60.0100.04316.19
5.4.50.0130.03316.56
5.4.40.0300.02716.59
5.4.30.0170.03716.58
5.4.20.0200.02716.39
5.4.10.0130.04316.49
5.4.00.0130.03316.00
5.3.290.0130.08014.78
5.3.280.0230.07014.78
5.3.270.0170.03314.68
5.3.260.0130.03714.79
5.3.250.0100.04014.68
5.3.240.0200.04714.58
5.3.230.0100.04014.59
5.3.220.0130.03714.72
5.3.210.0130.03714.62
5.3.200.0100.05014.55
5.3.190.0130.03714.69
5.3.180.0130.03714.54
5.3.170.0170.03314.61
5.3.160.0130.03714.64
5.3.150.0170.04014.55
5.3.140.0130.03714.63
5.3.130.0130.03714.58
5.3.120.0100.04014.53
5.3.110.0130.03714.77
5.3.100.0130.03714.07
5.3.90.0100.03714.17
5.3.80.0200.03314.10
5.3.70.0130.04014.16
5.3.60.0170.03014.07
5.3.50.0130.03714.13
5.3.40.0170.03313.90
5.3.30.0070.04014.00
5.3.20.0130.03313.73
5.3.10.0100.03713.63
5.3.00.0230.03713.71
5.2.170.0130.03712.26
5.2.160.0100.03312.26
5.2.150.0170.03012.26
5.2.140.0070.03312.26
5.2.130.0100.03012.26
5.2.120.0100.03012.26
5.2.110.0100.03012.26
5.2.100.0200.05712.26
5.2.90.0200.02012.26
5.2.80.0170.05012.26
5.2.70.0200.02312.26
5.2.60.0030.04312.26
5.2.50.0100.05312.26
5.2.40.0170.03312.26
5.2.30.0170.03312.26
5.2.20.0170.06012.26
5.2.10.0170.06312.26
5.2.00.0130.06012.26
5.1.60.0130.05312.26
5.1.50.0130.03312.26
5.1.40.0230.02312.26
5.1.30.0170.05312.26
5.1.20.0230.02312.26
5.1.10.0200.03712.26
5.1.00.0230.04712.26
5.0.50.0070.02712.26
5.0.40.0130.02312.26
5.0.30.0100.06312.26
5.0.20.0070.04312.26
5.0.10.0100.04312.26
5.0.00.0130.06012.26
4.4.90.0030.01712.26
4.4.80.0070.01712.26
4.4.70.0030.02312.26
4.4.60.0070.02012.26
4.4.50.0070.03712.26
4.4.40.0100.03312.26
4.4.30.0030.02312.26
4.4.20.0070.03712.26
4.4.10.0130.02712.26
4.4.00.0100.05312.26
4.3.110.0030.02712.26
4.3.100.0100.02312.26
4.3.90.0130.03012.26
4.3.80.0100.05012.26
4.3.70.0070.02312.26
4.3.60.0070.03312.26
4.3.50.0030.03012.26
4.3.40.0100.04312.26
4.3.30.0000.02712.26
4.3.20.0000.03712.26
4.3.10.0070.02312.26
4.3.00.0030.02312.26

preferences:
48.55 ms | 401 KiB | 5 Q