LMPX.COM |
Home | Linux | Mysql | PHP | XML | ||
|
|
|||
From: Shawn McKenzie Date: Thu Jul 2 21:18:42 2009 Subject: Re: Implode a 2D Array
salmarayan wrote: > Can any one tell me how can i implode a two D Array. > i can implode normal arrays, but when i try to implode multidimensional > Arrays, the result is empty. > can some one tell me how to implode an array Like This > > > $x=array ( [0] => array ( [side] => sell [stock_code] => AFMC.CA [quantity] > => 200 ) , > [1] => array ( [side] => buy [stock_code] => AFMC.CA [quantity] => 200 ); > > i want to implode it in a way, the later one i can seperate rows, meaning i > can seperate [0] from [1] and the elements in each row, like the side stock > code using the SPLIT function. > Thanks in Advance. :) You'll have to be more specific in what you want the end result to be becuse I'm confused. You already have 0 and 1 separated. How do you want to glue them? Maybe you don't really want to implode() them? If you really want to implode each one, then: foreach($x as $array) { $row[] = implode(',', $array); } Or maybe (not tested): $rows = array_map('implode', array_fill(0, count($x), ','), $x); -- Thanks! -Shawn http://www.spidean.com
| Navigate in group php.general at sever news.php.net | |
| Previous | Next |
| © No Copyright You are free to use Anything |
Site Maintained by Zareef Ahmed
Powered By PHP Consultants |