The "class name prefix" is part of the (internal) property name. Since you declared private PHP, you need to distinguish something from the $a and $b properties of any subclass.
The easiest way to get around it is not to create them private . Instead, you can declare them as protected .
However, this is not a solution in every case, because something is usually declared as private with intent. I recommend implementing a method that does the conversion for you. This gives you even more control over how the resulting array looks like
public function toArray() { return array( 'a' => $this->a, 'b' => $this->b ); }
source share