You will need to create an instance of the class:
$instance=new first();
and then you can access the variable from this instance:
$var=$instance->var1;
Note. When you instantiate this object, there is no $ in front of the class name.
Daveyboy
source share