OOP PHP in practice : I have problem with OOP, I use external xml, this works, but I have another problem. In my __construct I have $elem which is responsible for filtering the xml data. But it not working. Please help. I dont how to bite it.


    class  Property {
        public $xmlClass;
        public $array = [];
        public $elem = '';
        public function __construct($xml,$elem) {
        $this->xmlClass=$xml;

          foreach($xml->list->film->$elem as $result) {
            $array = array_push($result);

          }
       }
    }




    $result_scenario = new Property($xml,'scenario');
    print_r($result_scenario);