Welcome Guest, Not a member yet? Register   Sign In
Exploding Array Elements... Using explode TWICE
#1

[eluser]PoetaWD[/eluser]
Hello,

I am having a problem that I think it is simple...

I need to explode TWICE a string....

I am able to explode a string and that returns me a array();

What I need is create a loop to go over each element in the array and EXPLODE it again !

The result would be a array inside a array.

Example:

Code:
$str = 'engine,browser,platform,version,avaliator/name'

//Exploding it
array = explode(',', $str);
That would return me this array...
Code:
array(
[0] => 'engine',
[1] => 'browser',
[2] => 'platform',
[3] => 'version',
[4] => 'avaliator/name'
)

Now I need to explode each element with the '/'. Check the last value of my array.

The result I want would be:

Code:
array(
[0] => 'engine',
[1] => 'browser',
[2] => 'platform',
[3] => 'version',
[4] => array( [0] => 'avaliator'
              [1] => 'name')
)

Thanks for helping me


Messages In This Thread
Exploding Array Elements... Using explode TWICE - by El Forum - 04-26-2010, 12:24 AM
Exploding Array Elements... Using explode TWICE - by El Forum - 04-26-2010, 12:38 AM
Exploding Array Elements... Using explode TWICE - by El Forum - 04-26-2010, 12:48 AM
Exploding Array Elements... Using explode TWICE - by El Forum - 04-26-2010, 01:08 AM
Exploding Array Elements... Using explode TWICE - by El Forum - 04-26-2010, 01:12 AM
Exploding Array Elements... Using explode TWICE - by El Forum - 04-26-2010, 01:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB