Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- implode() function
- DJ Craig
March 1, 2005, 1:32 am
rate this thread
I have 2-dimensional array with numeric indices for both dimensions,
called $results, which contains the search results from a database.
The first dimension contains the records, and the second contains the
fields. I want to convert it into an XHTML table to echo to the
browser. For a 1-dimensional array, I would do this with implode().
Can I use implode() on a 2D array? If not, is there some other
function I could use to do this, or will I have to write my own? Or
has anyone already written one?
Re: implode() function
I'm honestly surprised you would use implode() to render a
1-dimensional array in XHTML. That's a rather hackish approach to the
You'll have to write your own, but the problem is pretty trivial.
Just iterate both dimensions of the array and print out what you need.