To simply enlist all methods and properties of an object simply write:
<?php ReflectionObject::export($yourObject); ?>
,which will cause an var_export-like output.
(PHP 5, PHP 7)
ReflectionObject クラスは オブジェクトについての情報を報告します。
オブジェクトのクラス名。読み込み専用で、書き込もうとすると ReflectionException をスローします。
To simply enlist all methods and properties of an object simply write:
<?php ReflectionObject::export($yourObject); ?>
,which will cause an var_export-like output.
class a {
const abc = 1;
public function __get($key){
$r = new ReflectionObject($this);
if($r->hasConstant($key)){ return $r->getConstant($key); }
}
}
class b {
public function getA(){
return new a();
}
}
$b = new b();
var_dump($b->getA()::abc);
var_dump($b->getA()::def);