3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { public $bar = 'A'; public function doSomething() { $this->bar = 'B'; yield; } } $foo = new Foo(); echo $foo->bar . PHP_EOL; ReflectionClass::export($foo->doSomething()); echo $foo->bar . PHP_EOL;
based on b7og0
Output for 7.0.0 - 7.1.0
A Class [ <internal:Core> <iterateable> final class Generator implements Iterator, Traversable ] { - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [0] { } - Methods [9] { Method [ <internal:Core, prototype Iterator> public method rewind ] { - Parameters [0] { } } Method [ <internal:Core, prototype Iterator> public method valid ] { - Parameters [0] { } } Method [ <internal:Core, prototype Iterator> public method current ] { - Parameters [0] { } } Method [ <internal:Core, prototype Iterator> public method key ] { - Parameters [0] { } } Method [ <internal:Core, prototype Iterator> public method next ] { - Parameters [0] { } } Method [ <internal:Core> public method send ] { - Parameters [1] { Parameter #0 [ <required> $value ] } } Method [ <internal:Core> public method throw ] { - Parameters [1] { Parameter #0 [ <required> $exception ] } } Method [ <internal:Core> public method getReturn ] { - Parameters [0] { } } Method [ <internal:Core> public method __wakeup ] { - Parameters [0] { } } } } A
Output for hhvm-3.12.0
A Class [ <internal:> <iterable> final class Generator implements HH\KeyedIterator, HH\Iterator, HH\Traversable, Iterator, Traversable, HH\KeyedTraversable ] { - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [0] { } - Methods [12] { Method [ <internal, ctor> private method __construct ] { } Method [ <internal, implements HH\Iterator> public method current ] { } Method [ <internal, implements HH\Iterator> public method key ] { } Method [ <internal, implements HH\Iterator> public method next ] { } Method [ <internal> public method throw ] { - Parameters [1] { Parameter #0 [ <required> object $ex ] } } Method [ <internal, implements HH\Iterator> public method rewind ] { } Method [ <internal, implements HH\Iterator> public method valid ] { } Method [ <internal> public method send ] { - Parameters [1] { Parameter #0 [ <required> HH\mixed $v ] } } Method [ <internal> public method raise ] { - Parameters [1] { Parameter #0 [ <required> HH\mixed $v ] } } Method [ <internal> public method getReturn ] { } Method [ <internal> public method getOrigFuncName ] { } Method [ <internal> public method getCalledClass ] { } } } A
Output for hhvm-3.10.0
A Class [ <internal:> <iterable> final class Generator implements HH\KeyedIterator, HH\Iterator, HH\Traversable, Iterator, Traversable, HH\KeyedTraversable ] { - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [0] { } - Methods [11] { Method [ <internal, ctor> private method __construct ] { } Method [ <internal, implements HH\Iterator> public method current ] { } Method [ <internal, implements HH\Iterator> public method key ] { } Method [ <internal, implements HH\Iterator> public method next ] { } Method [ <internal> public method throw ] { - Parameters [1] { Parameter #0 [ <required> object $ex ] } } Method [ <internal, implements HH\Iterator> public method rewind ] { } Method [ <internal, implements HH\Iterator> public method valid ] { } Method [ <internal> public method send ] { - Parameters [1] { Parameter #0 [ <required> HH\mixed $v ] } } Method [ <internal> public method raise ] { - Parameters [1] { Parameter #0 [ <required> HH\mixed $v ] } } Method [ <internal> public method getOrigFuncName ] { } Method [ <internal> public method getCalledClass ] { } } } A
Output for 5.5.24 - 5.6.28
A Class [ <internal:Core> <iterateable> final class Generator implements Iterator, Traversable ] { - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [0] { } - Methods [8] { Method [ <internal:Core, prototype Iterator> public method rewind ] { - Parameters [0] { } } Method [ <internal:Core, prototype Iterator> public method valid ] { - Parameters [0] { } } Method [ <internal:Core, prototype Iterator> public method current ] { - Parameters [0] { } } Method [ <internal:Core, prototype Iterator> public method key ] { - Parameters [0] { } } Method [ <internal:Core, prototype Iterator> public method next ] { - Parameters [0] { } } Method [ <internal:Core> public method send ] { - Parameters [1] { Parameter #0 [ <required> $value ] } } Method [ <internal:Core> public method throw ] { - Parameters [1] { Parameter #0 [ <required> $exception ] } } Method [ <internal:Core> public method __wakeup ] { - Parameters [0] { } } } } A
Output for 5.2.14 - 5.2.17, 5.3.3 - 5.4.45
A Notice: Use of undefined constant yield - assumed 'yield' in /in/45W16 on line 10 Fatal error: Uncaught exception 'ReflectionException' with message 'Class does not exist' in /in/45W16:16 Stack trace: #0 [internal function]: ReflectionClass->__construct('') #1 /in/45W16(16): ReflectionClass::export(NULL) #2 {main} thrown in /in/45W16 on line 16
Process exited with code 255.
Output for 5.1.3 - 5.2.13, 5.3.0 - 5.3.2
A Notice: Use of undefined constant yield - assumed 'yield' in /in/45W16 on line 10 Fatal error: Uncaught exception 'ReflectionException' with message 'Class does not exist' in /in/45W16:16 Stack trace: #0 [internal function]: ReflectionClass->__construct(NULL) #1 /in/45W16(16): ReflectionClass::export(NULL) #2 {main} thrown in /in/45W16 on line 16
Process exited with code 255.
Output for 5.0.5 - 5.1.2
A Notice: Use of undefined constant yield - assumed 'yield' in /in/45W16 on line 10 Fatal error: Uncaught exception 'ReflectionException' with message 'Class does not exist' in /in/45W16:16 Stack trace: #0 [internal function]: ReflectionClass::__construct(NULL) #1 /in/45W16(16): ReflectionClass::export(NULL) #2 {main} thrown in /in/45W16 on line 16
Process exited with code 255.
Output for 5.0.3 - 5.0.4
A Notice: Use of undefined constant yield - assumed 'yield' in /in/45W16 on line 10 Fatal error: Uncaught exception 'ReflectionException' with message 'Class does not exist' in /in/45W16:16 Stack trace: #0 /in/45W16(16): ReflectionClass::__construct(NULL) #1 /in/45W16(16): ReflectionClass::export(NULL) #2 {main} thrown in /in/45W16 on line 16
Process exited with code 255.
Output for 5.0.2
A Notice: Use of undefined constant yield - assumed 'yield' in /in/45W16 on line 10 Fatal error: Uncaught exception 'ReflectionException' with message 'Class does not exist' in /in/45W16:16 Stack trace: #0 /in/45W16(16): ReflectionClass::export(NULL) #1 {main} thrown in /in/45W16 on line 16
Process exited with code 255.
Output for 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/45W16 on line 15 APHP_EOL Notice: Use of undefined constant yield - assumed 'yield' in /in/45W16 on line 10 Fatal error: Uncaught exception 'ReflectionException' with message 'Class does not exist' in /in/45W16:16 Stack trace: #0 /in/45W16(16): ReflectionClass::export(NULL) #1 {main} thrown in /in/45W16 on line 16
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/45W16 on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/45W16 on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/45W16 on line 5
Process exited with code 255.