PHP/Reflection/get class vars — различия между версиями

Материал из Web эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 10:07, 26 мая 2010

get_class_vars() function returns an array of attributes defined in the class specified by class_name.

   <source lang="html4strict">

//Its syntax is: array get_class_vars (string class_name) //Using get_class_vars() to create $attribs

<? class Vehicle {

    var $model;
    var $current_speed;

} class Airplane extends Vehicle {

    var $wingspan;

} $a_class = "Airplane"; $attribs = get_class_vars($a_class); print_r($attribs); ?>

 </source>