Hello,
I'd like to read data in a xml file (see the example below) and use them into the PHP code like this:
* test.xml:
<variable>
<firstdata>data1</firstdata>
<seconddata>data2</seconddata>
</variable>
* test.php:
<?
include "xmlparser.php"; (<- This should be implemented.)
echo "First Data: " $firstdata:
echo "Second Data: " $seconddata:
?>
xmlparser.php should parse the xml data and dynamically create php variable ($firstdata) and store "data1" into $firstdata.
I could find a lot of example of using $variable['firstdata'] but this is not what I want. I want to use $firstdata.
Please help me on this issue.
Thanks,
$firstdata = $variable["firstdata"]
this is not a good solution because I don't know which variable will be used.
xmlparser.php has to have a kind of general rule because this php file should be in every php pages.
$firstdata = $variable["firstdata"]
this is not a good solution because I don't know which variable will be used.
xmlparser.php should have a kind of general rule because this php file should be included in every php page.
I'd like to read data in a xml file (see the example below) and use them into the PHP code like this:
* test.xml:
<variable>
<firstdata>data1</firstdata>
<seconddata>data2</seconddata>
</variable>
* test.php:
<?
include "xmlparser.php"; (<- This should be implemented.)
echo "First Data: " $firstdata:
echo "Second Data: " $seconddata:
?>
xmlparser.php should parse the xml data and dynamically create php variable ($firstdata) and store "data1" into $firstdata.
I could find a lot of example of using $variable['firstdata'] but this is not what I want. I want to use $firstdata.
Please help me on this issue.
Thanks,
$firstdata = $variable["firstdata"]
this is not a good solution because I don't know which variable will be used.
xmlparser.php has to have a kind of general rule because this php file should be in every php pages.
$firstdata = $variable["firstdata"]
this is not a good solution because I don't know which variable will be used.
xmlparser.php should have a kind of general rule because this php file should be included in every php page.