0

I am trying to generate an xml row but for some reason php is throwing me the following error

function get_galleryxml_row($row) {

    $xml_output  = '';

    $images = $this->exporter->get_property_gallery_data($row['id']);

    foreach($images as $field => $value)
        $xml_output .= "\n\t\t" . "<$field>". $value ."</$field>";

    return $xml_output;    
}

[20-May-2015 16:13:17 UTC] PHP Notice: Array to string conversion in

What is the problem in my code and how can I solve it?

c-sharp-and-swiftui-devni
  • 3,743
  • 4
  • 39
  • 100
  • 1
    give us a `print_r()` of `$images` – mariobgr May 20 '15 at 16:16
  • this is a different answer rizer not in relation to the json so its not a duplicate this is for xml out put ! so incrroect – c-sharp-and-swiftui-devni May 20 '15 at 16:19
  • this is not a duplicate question totoally diferent subject ! – c-sharp-and-swiftui-devni May 20 '15 at 16:20
  • Then edit your question and show *why* you think this is not a dupe. – Rizier123 May 20 '15 at 16:23
  • The linked question is a reference explaining many typical error message including this one: http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php/24507107#24507107 Your problem is not related to XML in any way. For PHP you're just generating some text. You don't use an XML library. – ThW May 20 '15 at 16:25
  • `$value` is an array - not a string. That's why you're getting this error. `print_r($value)` will tell you how it *actually* looks. – h2ooooooo May 20 '15 at 16:27

0 Answers0