Hướng dẫn xml foreach php
Anyone that knows PHP and XML out there? Then please have a look! This is my PHP code:
This is mys XML file:
The outcome of the code above is:
I want it to be like this (see category on the first movie):
Note: Also I wonder how to get the comma between the words, but without a comma on the last word... asked Jan 9, 2011 at 4:02
0 Try this.
answered Jan 9, 2011 at 4:11
JonahJonah 9,8915 gold badges44 silver badges79 bronze badges 1 this is how you use foreach with an simplexmlElement:
answered Nov 6, 2013 at 12:59
answered Jan 9, 2011 at 4:20 You need to iterate through the
You'll probably want to trim the trailing The method mentioned in my comment:
answered Jan 9, 2011 at 4:09
Dan LuggDan Lugg 19.7k18 gold badges107 silver badges172 bronze badges
answered Jan 9, 2011 at 4:10
dqhendricksdqhendricks 18.6k10 gold badges48 silver badges82 bronze badges
Then you can jsut call it from your loop like:
Using an array and Isolating it in a function makes it easier to maintain and is less confusing than nesting the loop (though admittedly nested loops arent that confusing). answered Jan 9, 2011 at 4:14
prodigitalsonprodigitalson 59.5k9 gold badges97 silver badges112 bronze badges Try This one
answered Jun 25, 2016 at 12:32
Ajay KumarAjay Kumar 1,30412 silver badges22 bronze badges 2 |