I'm in the phase of learning OOP in PHP and i wanna know how to call a variable from another PHP class.
eg.
class first {
public $var1 = 1;
}
I guess it's this way but i don't know how to continue:
$first = new $first();
You should do something like this:
$first = new first();
echo $first->var1;
You need to call it like this:
$first = new first();
$first->var1;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With