I have a class like the following:
class game {
public $db;
public $check;
public $lang;
public function __construct() {
$this->che
How can I call the result of that variable from another class, lets call it class Check?
A variable doesn't have a result. If you mean to retrieve the state of that variable on a specific object $obj
of class game
then you can simply do:
$obj->lang
On a side note if $lang
is publicly only read only you should protect it by defining it private
or protected
and create a getter method instead.
If you mean that you want to use the same variable name in another class I'd suggest you to consider inheritance:
class Check extends game { /* now Check has $lang */ }
but the variable of the two objects will be different.