Jump to content

Qaaolchoura

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Qaaolchoura's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. It seemed like it'd be easier for me to handle for small datasets than a subarray, but yeah, when I say it I realize that's a bad reason. Any rate, thanks ~Q
  2. Hello, sorry if this is idiotic, but I couldn't find the answer either elsewhere. Is there a way to include a double (or more) arrow in an array, without using subarrays? For example, if I had a set of information about music that I wanted to export as xml (as I did for an experiment). </php <-- create document, header, etc--> $dataArray = array("Graceland" => "Paul Simon" => "Rock", "Days of Future Passed" => "Moody Blues" => "Rock"); foreach($dataArray as $nameArr => $artistArr => $genreArr) { //create data for name $name = $dom->createElement('name'); $nameText = $dom->createTextNode($nameArr); $name->appendChild($nameText); <--repeat for $artist & $genre--> // create node for album and add data as child $album = $dom->createElement('album'); $album->appendChild($name); $album->appendChild($artist); $album->appendChild($genre); } <--output xml--> ?> I get an error because of the unexpected double arrow. Ultimately I'd want to draw this from a mySQL database rather than using static arrays, but I'm still wondering if there's a way to do this. It seems like it'd be useful if I wanted to pass arrays from one php file to another. Thanks, ~Q
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.