You are here: Re: PHP Complex Data Structures « PHP « IT news, forums, messages
Re: PHP Complex Data Structures

Posted by Matthew Weier O'Phinney on 10/20/87 11:16

* Zzapper <david@tvis.co.uk>:
> I seem to remember that you access/use PHP data in the same/similar
> way to Perl data and that you can create complex data structures ie
> arrays of arrays, arrays of records etc.
>
> For once Google let me down so can any one point at any doc info.

Did you try building any complex data structures? You could have whipped
out something to test pretty quickly. The quick answer is, 'Yes'.

The longer answer is: cut-and-past the following into a script and see
what you get:

$cds = array(
'element1' => array(
'string1',
'string2',
'string3'
),
'element2' => true,
'element3' => array(
'subelement1' => array(
array(1, 2, 3),
2,
3
)
)
);
var_dump($cds);

You can create any complexity you want using nested arrays. Arrays in
PHP are ordered (also called indexed) unless string keys are used (in
which case they're called associative) -- and you can mix and match
styles as needed.

Additionally, you can use these structures within objects, and define
object properties on the fly.

Read through the manual about variable types if you need more
information -- and don't be afraid to experiment.

--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthew@garden.org | http://vermontbotanical.org

 

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

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