Hi, sorry I’m a bit newbie to PHP and I’ve been looking around but having trouble finding out how to do this.
I’m making a simple PHP website but I have no idea how to get PHP to read data form an xml. I’ve heard of simpleXML but I need a bit of help, epic newb here XD
Anyway, here is the XML I want PHP to take the data form.
<Object1 color="Red" weight="5" image="images/Object1.png"/>
<Object2 color="Green" weight="4" image="images/Object2.png">
I have an array in my php that randomly selects one of the objects.
I want to put the values in an array and then store them as separate variables.
The file then prints:
[php]print “The object you see is $color and weighs $weight kilos.”;[/php]
Any help much appreciated