Re: Recursive array_push?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kim Christensen wrote:
Has anyone out there stumbled over the issue of making
multi-dimensional arrays out of bracket-separated strings? In a less
fuzzy way of putting it:

$str = "[layer1][layer2][layer3][layer4]"

would become

$str_array = Array( [layer1] => Array( [layer2] => Array( [layer3] =>
Array( [layer4] ) ) ) );

...or something similar. Passing values is not an issue at the moment,
it's just the recursive thinking that keeps bugging me right now, and
my temporary solution to this matter is not even mentionable!

I would really like PHP to have a function of building expressions
with strings, and then execute them through a function - but that's
just me it seems :-)

--
Kim Christensen
kim.christensen@xxxxxxxxx

how about...
$str = '[layer1][layer2][layer3][layer4]';
eval('$str_array'.$str.' = "";');
?
(obviously the value can be anything at the end)

- tul

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux