Solved

Array in Array in Array in Array to one Array

Posted on 2003-11-12
1
248 Views
Last Modified: 2008-03-06
I had an array:

Array
(
 [0] => Array
           (
                [0] => Array
                          (
                                 [0] => a
                                 [1] => b
                                 [2] => c
                          )
                [1] => A
                [2] => B
                [3] => C
           )
)

And more sub array in main array

Now I would like to be:

Array
(
    [0] => a
    [1] => b
    [2] => c
    [3] => A
    [4] => B
    [5] => C
)

Please help me the way to make it in PHP!

Thank you very much indeed!
0
Comment
Question by:teekai
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 6

Accepted Solution

by:
DoppyNL earned 200 total points
ID: 9730922
this should do the trick:

function single_array($entry)
{
    if(!isset($result))
        $result = array();
    foreach ($entry as $item)
    {
        if (is_array($item))
             $result = array_merge($result, single_array($item));
        else
             $result[] = $item
    }
    return($result);
}
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question