(PHP 5, PHP 7)
ReflectionClass::export — Exports a class
Ця функція ЗАСТАРІЛА, починаючи з PHP 7.4.0, та ВИЛУЧЕНА в PHP 8.0.0. Вкрай не рекомендується на неї покладатися.
Exports a reflected class.
argumentОб'єкт Reflection, що експортується.
return
Якщо задано true, результат буде повернено, а якщо false (початково), то
результат буде виведено.
Якщо параметр return дорівнює true, то
то повернеться рядок (string), а інакше — null.
Приклад #1 Basic usage of ReflectionClass::export()
<?php
class Apple {
public $var1;
public $var2 = 'Orange';
public function type() {
return 'Apple';
}
}
ReflectionClass::export('Apple');
?>Поданий вище приклад виведе щось схоже на:
Class [ <user> class Apple ] {
@@ php shell code 1-8
- Constants [0] {
}
- Static properties [0] {
}
- Static methods [0] {
}
- Properties [2] {
Property [ <default> public $var1 ]
Property [ <default> public $var2 ]
}
- Methods [1] {
Method [ <user> public method type ] {
@@ php shell code 5 - 7
}
}
}