Reply to Re: associative arrays as variable variables ($$)

Your name:

Reply:


Posted by JDS on 07/22/05 18:42

On Fri, 22 Jul 2005 06:46:54 -0700, evanescent.lurker@gmail.com wrote:

> But this means I cannot programmaticaly change the structure part? I
> want to sometimes use $data['Objects']['Spheres'] and sometimes
> $data['Objects']['Cubes']

Well, of course you can.

in place of 'Spheres' use a variable. In fact, use variables for
everything if you like:

<?php
$theData = 'data';
$theObject = 'Objects';
$which = 'Spheres';

echo $$data[$theObject][$which];

?>

You get the idea...


--
JDS | jeffrey@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

[Back to original 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

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