Current location: Hot Scripts Forums » Programming Languages » PHP » Arrays with sub arrays


Arrays with sub arrays

Reply
  #1 (permalink)  
Old 09-30-05, 03:19 PM
perleo perleo is offline
Coding Addict
 
Join Date: Jul 2003
Location: Ireland
Posts: 269
Thanks: 0
Thanked 0 Times in 0 Posts
Arrays with sub arrays

Hi

I have an array like this
Code:
 array[0] (
                   array[0] (
                                   name => val
                                    array[0] (
                                                  array()
                                                 )
                                )
              )
is there a way to get each array into sepearate arrays?

so as theres 3 array's in the above example, is there a way to get

$array0 = array( [values in here excluding sub arrays ] );
$array1 = array();
$array2 = array();
$array3 = array();

?
Reply With Quote
  #2 (permalink)  
Old 09-30-05, 07:15 PM
Acecool's Avatar
Acecool Acecool is offline
Aspiring Coder
 
Join Date: Nov 2003
Posts: 506
Thanks: 0
Thanked 0 Times in 0 Posts
$array1 = $array['1'];
$array2 = $array['2'];
$array3 = $array['1']['0'];

Or run a foreach, if is array continue and make a variable

$array{$i} = ...
__________________
Check Acecoolco.com for PHP Tutorials, and other tuts
If you plan on contacting me, please read this: Legal Terms & Conditions
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare arrays drophit PHP 0 07-09-05 03:33 PM
Structures vs. Arrays addit C/C++ 1 07-06-05 02:10 PM
Can record arrays on database? mhs12grade1992 PHP 5 02-17-05 11:20 AM
arrays in functions Slypher PHP 3 01-30-05 05:36 AM
Arrays cebuy PHP 1 10-25-04 07:40 AM


All times are GMT -5. The time now is 06:13 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.