PHP 8.5.0 RC 2 available for testing

Voting

: zero minus zero?
(Example: nine)

The Note You're Voting On

sagittaracc at gmail dot com
4 years ago
if you ever need to get the body of a method, use this extension (https://github.com/sagittaracc/reflection):

namespace sagittaracc\classes;

class Test
{
public function method()
{
if (true) {
return 'this method';
}

return 'never goes here';
}
}

$reflection = new ReflectionClass(Test::class);
$method = $reflection->getMethod('method');
echo $method->body; // if (true) { return 'this method'; } return 'never goes here';

<< Back to user notes page

AltStyle によって変換されたページ (->オリジナル) /