src/XSD2PHP/src/com/mikebevz/xsd2php/Php2Xml.php
private function get_class_vars_fix_order($className)
    {
        $propNames = array();
        $parentClassName = get_parent_class($className);

        $classMembersOnlyInherited = array();
        if ($parentClassName) {
            $classMembersOnlyInherited = $this->get_class_vars_fix_order(get_parent_class($className));
        }

        $classMembersIncludingInherited = array_keys(get_class_vars($className));
        $classMembersNotInherited = array_diff($classMembersIncludingInherited, $classMembersOnlyInherited);
        $orderedClassMembers = array_merge($classMembersOnlyInherited, $classMembersNotInherited);

        return $orderedClassMembers;
    }
private function get_class_vars_fix_order($className)
    {
        $propNames = array();
        $parentClassName = get_parent_class($className);

        $classMembersOnlyInherited = array();
        if ($parentClassName) {
            $classMembersOnlyInherited = $this->get_class_vars_fix_order(get_parent_class($className));
        }

        $classMembersIncludingInherited = array_keys(get_class_vars($className));
        $classMembersNotInherited = array_diff($classMembersIncludingInherited, $classMembersOnlyInherited);
        $orderedClassMembers = array_merge($classMembersOnlyInherited, $classMembersNotInherited);

        return $orderedClassMembers;
    }
get_class_vars_fix_order

Mitigates a problem with get_class_vars, wherein get_class_vars does not honor the
order of class members derived via 'extend' of a parent class (potentially even an
extend that has multiple layers of inheritance)

@param string $className

@return array