By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,278 Members | 1,359 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,278 IT Pros & Developers. It's quick & easy.

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

P: 1
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($one,$two);

here "one" is the one of the tab in the page
if i click the tab "Text1"should be printed in the page likewise "Text2"should 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
Feb 23 '07 #1
Share this Question
Share on Google+
2 Replies


ronverdonk
Expert 2.5K+
P: 4,258
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:
Feb 23 '07 #2

P: 99

$one=array("one" =>"Text1");
$two=array(
"two" =>array(
"a" =>array(
"b" =>"Text2"
)
)
);
$main=array($one,$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.
Feb 23 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.