class MyClass{ public $var0; private $var1; protected $var2; function __construct(){ for($i=0; $i<4; $i++){ $varname = 'var'.$i; if(объявлена($this->$varname)){ print($varname.' here'); }else{ print('there is no '.$varname); } } } } 

Conclusion:

 var0 here var1 here var2 here there is no var3 

Realizable? How?
PS isset did not work for some reason.

    1 answer 1

    And if you try the functions:

     print_r(get_class_vars("MyClass")); print_r(get_class_methods("MyClass")); 

    Which return everything in arrays and also return initial values. And, as I understand it, it’s not for nothing that you in the class use private , public and protected modifiers. So, these functions just work correctly with modifiers.

    • Exl, quite get away. Next - you can already run through this array. Thank. - knes