(PHP 7)
ReflectionClass::isAnonymous — Checks if class is anonymous
Checks if a class is an anonymous class.
此函数没有参数。
成功时返回 TRUE
, 或者在失败时返回 FALSE
。
Example #1 ReflectionClass::isAnonymous() example
<?php
class TestClass {}
$anonClass = new class {};
$normalClass = new ReflectionClass('TestClass');
$anonClass = new ReflectionClass($anonClass);
var_dump($normalClass->isAnonymous());
var_dump($anonClass->isAnonymous());
?>
以上例程会输出:
bool(false) bool(true)