On Thu, January 26, 2006 2:50 am, 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(
Kim,
After some contemplation (and slightly less crack):
$array);
}
print_r($array);
?>
Array
(
[layer1] => Array
(
[layer2] => Array
(
[layer3] => Array
(
[layer4] => FOO
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]
Kim,
May the hack-o-rama commence:
It works, but I'm not proud. :P
David
--
David Grant
http://www.grant.org.uk/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On 1/26/06, Kim Christensen <[EMAIL PROTECTED]> wrote:
>
> 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 :-)
>
You mean like create_function() ?
-robin
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] ) ) )
6 matches
Mail list logo