You are here: navigate multidimensional array with path in flat array « PHP Programming Language « IT news, forums, messages
navigate multidimensional array with path in flat array

Posted by Snaggy on 10/18/07 15:32

I have a big multidimensional array and I need to access it at various
levels. The path is stored in a flat array:

I'm doing it like this:

$path = array("people", "men", "tall")

$my_array = <---- this is the big array!

foreach ($path as $x) {$p .= "[\"".$x."\"]" ;}
$str = "$part = $my_array".$p;
eval($str);

which works but is very ugly, I'd like to do something like

$temp = $my_array[$path];

but it doesn't work of course.

What can I do?

thanks

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация