PHP Classes

Need help creatig array of array

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  Need help creatig array of array  
Subject:Need help creatig array of array
Summary:PHP
Messages:2
Author:Tanmoy Ghoshal
Date:2010-02-08 05:52:36
Update:2010-02-10 07:53:49
 

  1. Need help creatig array of array   Reply   Report abuse  
Picture of Tanmoy Ghoshal Tanmoy Ghoshal - 2010-02-08 05:56:00
Hi, Everybody

I am getting the array from database in this structure:

Array (
[0] =>
Array (

[MAIN_CODE] => MAINTEST1
[SUB_CODE] => SUBTEST1
[MAINCODE_STATUS] => N
[SUBCODE_STATUS] => N
[CODE_TEST] => YES
)
[1] => Array (

[MAIN_CODE] => MAINTEST1
[SUB_CODE] => SUBTEST2
[MAINCODE_STATUS] => N
[SUBCODE_STATUS] => N
[CODE_TEST] => NO
)
)
but I want the create output for above array in different array structure that below I mentioned:

Array(
[MAINTEST1] =>
Array(
MAINCODE_STATUS => N
SUBTEST1 =>
Array(
SUBCODE_STATUS => N
CODE_TEST => YES
)
SUBTEST2 =>
Array(
SUBCODE_STATUS => N
CODE_TEST => NO
)

)
)

Can anybody help me how create this array using PHP.

Regards
Tanmoy

There is 1 reply in this thread, which is not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.