Access private attributes through a loop in php

0

I am doing a class for my database interaction and need to mount my DML commands based on a past class instance.

    foreach($obj as $key => $value){
        //monta comando DML 
    }

This only works if the class attributes are public, in the case of private this foreach gives no loop. Does anyone have any idea how I can do this? Or would the only way be to force the past object to have a method that returns its own attributes?

    
asked by anonymous 25.11.2018 / 00:42

0 answers