Here are two way to initialize class variables.
class Test { private $var1; private $var2; public function Test($var1,$var1) {
What about this
class A{ public $x; public $y; function A($var1=10,$var2=15){ //the default value for the class $this->x=$var1; $this->y=$var2; } } $object_of_A= new A(20,30); //if you do not want to change the default value then //pass no arguments