php foreach visible on page

Posted by Hintswen on Stack Overflow See other posts from Stack Overflow or by Hintswen
Published on 2010-05-26T04:55:58Z Indexed on 2010/05/26 5:01 UTC
Read the original article Hit count: 291

Filed under:
|
|

In my PHP code I have this:

$filename = 'data.xml';
$xml = file_get_contents($filename);
$data = simplexml_load_string($xml);
$variable = "";
foreach ($data->file_info as $record)
{
    $id1 = $record['id1'];
    $id2 = $record['id2'];
}

And it works perfectly fine on the web server, but when trying to view it locally (using xampp) I get the following output at the top of my pgae:

file_info as $record)
{
    $id1 = $record['id1'];
    $id2 = $record['id2'];
}

(followed by another 100 or so lines of PHP)

Not sure if it would make a difference, the web server it works on is running linux, and I am trying to view it on windows using xampp)

© Stack Overflow or respective owner

Related posts about php

Related posts about Xml