3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace ParserReflection\Stub; abstract class AbstractClassWithMethods { const TEST = 5; public function __construct(){} public function __destruct(){} public function explicitPublicFunc(){} function implicitPublicFunc(){} protected function protectedFunc(){} private function privateFunc(){} static function staticFunc(){} abstract function abstractFunc(); final function finalFunc(){} /** * @return string */ public function funcWithDocAndBody() { static $a =5, $test = '1234'; return 'hello'; } /** * @return \Generator */ public function generatorYieldFunc() { $index = 0; while ($index < 1e3) { yield $index; } } /** * @return int */ public function noGeneratorFunc() { $gen = function () { yield 10; }; return 10; } private function testParam($a, $b = null, $c = self::class, $d = self::TEST) {} } $refMethod = new \ReflectionMethod('ParserReflection\Stub\AbstractClassWithMethods', 'testParam'); echo "Exported: ", $refMethod;
Output for 5.6.17 - 7.2.0
Exported: Method [ <user> private method testParam ] { @@ /in/P9DXo 52 - 52 - Parameters [4] { Parameter #0 [ <required> $a ] Parameter #1 [ <optional> $b = NULL ] Parameter #2 [ <optional> $c = 'ParserReflectio...' ] Parameter #3 [ <optional> $d = 5 ] } }
Output for 5.5.24 - 5.6.16
Exported:
Process exited with code 139.
Output for 5.4.10 - 5.4.45
Parse error: syntax error, unexpected '$index' (T_VARIABLE) in /in/P9DXo on line 36
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_VARIABLE in /in/P9DXo on line 36
Process exited with code 255.