public function __construct($args) { $this->init_properties( $args ); } function init_properties( $args = false ) { $properties = get_class_vars( get_class( $this ) ); foreach ( $properties as $name => $val ) { if ( isset( $args[ $name ] ) ) { $this->$name = $args[ $name ]; } } }
Home → Code Basics → OOP
CMNTT