PHP Initialize class variables without Constructor
I have the following class,e.g.

    class A{
     public var1;
     public var2;
    }

now, I want to create an object of this class, and I do the following:

    $a = new A();
    $a->var1 = 123;
    $a->var2 = 987;

Is there a more better way to do this, since at times there can be even 20 such variables inside the class. I am just looking for compacting the code, and a constructor is not being used for this class. The values for variables are not static (that is why no static keyword is used)

Furthermore, how will I go around avoiding NullPointerException (which sometimes comes up when I try to send this object to a .Net enabled web service) - This is optional though, as I can atlst relate this to null variables inside the class, but not exactly sure how to overcome this error.
PHP Initialize class variables without Constructor
===

I have the following class,e.g.

    class A{
     public var1;
     public var2;
    }

now, I want to create an object of this class, and I do the following:

    $a = new A();
    $a->var1 = 123;
    $a->var2 = 987;

Is there a more better way to do this, since at times there can be even 20 such variables inside the class. I am just looking for compacting the code, and a constructor is not being used for this class. The values for variables are not static (that is why no static keyword is used)

Furthermore, how will I go around avoiding NullPointerException (which sometimes comes up when I try to send this object to a .Net enabled web service) - This is optional though, as I can atlst relate this to null variables inside the class, but not exactly sure how to overcome this error.