a recursive function that traverse the multi-dimensional array using explode()

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rvimalram
    New Member
    • Feb 2007
    • 1

    a recursive function that traverse the multi-dimensional array using explode()

    Hi all,

    I have a created a multidimesional array,what i need is to traverse that array and return the value of the array in the particular page
    the array is

    $one=array("one " =>"Text1");
    $two=array(
    "two" =>array(
    "a" =>array(
    "b" =>"Text2"
    )
    )
    );
    $main=array($on e,$two);

    here "one" is the one of the tab in the page
    if i click the tab "Text1"shou ld be printed in the page likewise "Text2"shou ld be printed in the particular page (ie) when i click the tab "two" "text2" should be printed in the page.

    a recursive fn should be used to traverse the array,also explode() should be used to split the array and traverse

    only one function must be used

    kindly help me out in this...its very urgent to me....

    vimal
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    You put quite some requirements on us. Do you expect us to write the code for this?

    We are here to help you out, so please show the code or any attempt at any related code you have developed so far. After seeing that we can help you with problems, not with complete scripts.

    And: when you show code display it within code or php tags!
    See the Posting Guidelines at the top of this forum before you post again.

    Ronald :cool:

    Comment

    • xwero
      New Member
      • Feb 2007
      • 99

      #3
      Originally posted by rvimalram

      $one=array("one " =>"Text1");
      $two=array(
      "two" =>array(
      "a" =>array(
      "b" =>"Text2"
      )
      )
      );
      $main=array($on e,$two);
      Why do you make it such difficult array construction?

      [PHP]
      $array = array('one' => 'text1', 'two' => array('a' => array('b' => 'text2')));
      [/PHP]

      This would be the same with one level less.

      Comment

      Working...