Answer the question
In order to leave comments, you need to log in
Initializing a class in a constructor?
Hi everyone there is:
class One extends Two{
public $obj;
public function __construct($param){
parent::_construct($param);
$obj = new Three();
}
public function obj_print(){
var_dump($obj); // NULL
}
}
Answer the question
In order to leave comments, you need to log in
In functions use $this->obj instead of $obj
php.net/manual/en/language.oop5.basic.php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question