implode() function

This is a discussion on implode() function within the PHP Language forums, part of the PHP Programming Forums category; I have 2-dimensional array with numeric indices for both dimensions, called $results, which contains the search results from a ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2005
DJ Craig
 
Posts: n/a
Default implode() function

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?

Reply With Quote
  #2 (permalink)  
Old 03-02-2005
DJ Craig
 
Posts: n/a
Default Re: implode() function

anybody?

Reply With Quote
  #3 (permalink)  
Old 03-02-2005
Wayne
 
Posts: n/a
Default Re: implode() function

On 28 Feb 2005 19:32:25 -0800, "DJ Craig" <spit@djtricities.com>
wrote:

>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?


I'm honestly surprised you would use implode() to render a
1-dimensional array in XHTML. That's a rather hackish approach to the
problem.

>If not, is there some other
>function I could use to do this, or will I have to write my own?


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.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 10:57 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0