protected function writeFields($fp, $fields)
    {
        foreach ($fields as $key => $value) {
            if (is_array($value)) {
                fwrite($fp, "<field name=\"$key\">\n");
                $this->writeFields($fp, $value);
                fwrite($fp, "</field>\n");
            } else {
                fwrite($fp, "<field name=\"$key\">\n<value>$value</value>\n</field>\n");
            }
        }
    }
protected function writeFields($fp, $fields)
    {
        foreach ($fields as $key => $value) {
            if (is_array($value)) {
                fwrite($fp, "<field name=\"$key\">\n");
                $this->writeFields($fp, $value);
                fwrite($fp, "</field>\n");
            } else {
                fwrite($fp, "<field name=\"$key\">\n<value>$value</value>\n</field>\n");
            }
        }
    }
protected function writeFields ( $ fp , $ fields ) { foreach ( $ fields as $ key => $ value ) { if ( is_array ( $ value ) ) { fwrite ( $ fp , "<field name=\"$key\">\n" ) ; $ this -> writeFields ( $ fp , $ value ) ; fwrite ( $ fp , "</field>\n" ) ; } else { fwrite ( $ fp , "<field name=\"$key\">\n<value>$value</value>\n</field>\n" ) ; } } }
Write the fields to the given filepointer

@param int $fp
@param mixed[] $fields an array of field values. A value can also be another array
in which case a nested field is written.
Write the fields to the given filepointer