Thanks for the replies!
This is a real world project, lots of money on the line, government bureaucracies, etc. XML is unfortunately not a solution I can use for this project. The problem is that the source for the array is going to be a tab indented text file.
Maybe my example caused confusion.
$contents['level1'][1]['level2'][0]='Level 1 Item 2 > Level 2 Item 1';
print $contents['level1'][1]['level2'][0]; // prints Level 1 Item 2 > Level 2 Item 1
I suppose I could have just written this:
$contents['level1'][1]['level2'][0]='Fred Flintstone';
print $contents['level1'][1]['level2'][0]; // prints Fred Flintstone
Or instead of using [] syntax I could do this:
$contents = array(
'level1'=>array(
0=>'item0,
1=>array(
'level2'=>array(
0=>'Fred Flintstone',
),
),
),
);
So, the question is how to get a tabbed indented text list into a properly formed array?