Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

programmatically defining an array with all class vars

Tags:

oop

php

class

is there a way to create an array containing all the public vars from a class without having to add them manually in PHP5?

I am looking for the quickest way to sequentially set a group of vars in a class

like image 714
Mild Fuzz Avatar asked Apr 18 '26 02:04

Mild Fuzz


1 Answers

Have a look at:

get_class_vars

With this you get the public vars in an array.

like image 166
enricog Avatar answered Apr 19 '26 17:04

enricog