Użyj zmiennej z __construct () w innych metodach
Zdefiniowałem nową zmienną w__construct()
i chcę go użyć w innymfunction
tegoclass
. Ale moja zmienna jest pusta w drugiej funkcji!
to jest mój kod:
class testObject{
function __construct() {
global $c;
$data = array("name"=>$c['name'],
"family"=>$c['family']);
}
function showInfo() {
global $data;
print_r($data);
}
}