Jump to content

Finding single array in multidimensional


spmckee

Recommended Posts

I am creating a navigation hierarchy out of a multidimensional array and am having a terrible time trying to pull a single array out. Here's the code:

 

<?

$L1_array = array( 'Colors & Shapes' => array (                                     'Colors' => array (
															'Orange',
															'Blue',
															'White',
															'Red'
															),
													'Shapes' => array(
															'Circle',
															'Square',
															'Triangle'
															),
													),
									'Animals & People' => array (
													'Animals' => array (
															'Ducks',
															'Snails',
															'Dogs' => array (
																	'Huskies',
																	'Chows',
																	'Retrievers' => array (
																			'Golden Retriever',
																			'Chesapeake Bay Retriever',
																			'Curly-Coated Retriever',
																			'Flat-Coated Retriever',
																			'German Water Spaniel',
																			'Golden Retriever',
																			'Irish Water Spaniel'
																			),
													'People' => array (
															'Russians',
															'Canadians',
															'Germans'
															),
														),
													)
?>

 

For instance, how can I pull out and loop through JUST the retrievers array? Any help is greatly appreciated!

 

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.