You are here: Re: Arrayed confusion « PHP Language « IT news, forums, messages
Re: Arrayed confusion

Posted by Jim Michaels on 10/31/95 11:37

maybe what you were tryiong to do was
$directory_tree = array(
'path' => "test path",
'name' => "test name");

instead. then you don't need the [0].
[] adds a new array index at <count++> for the newly assigned item. if the
variable didn't exist before, it starts with [0] and increments count after
that.
with the above assignment, you can add all the new items you want by just
assigning them. $directory_tree['fuzz']="blah";

"barret bonden" <arthur@networks-cc.com> wrote in message
news:EhXwf.81$h_.20@fe11.lga...
> Got it. Thank you all.
>
> ( Makes sense. What a joy of a language ~ ASP and VB.NET have been
> driving
> me nuts)
>
>
> "Zilla" <mail.is.not@an.option> wrote in message
> news:43C42721.9070009@an.option...
>> barret bonden wrote:
>> > having trouble with array of this design
>> > $directory_tree[] = array(
>> > 'path' => "test path",
>> > 'name' => "test name");
>> >
>> > all my efforts at getting at the data don't work ...
>> >
>> > //print( $directory_tree["path"]) ;
>> > //print( $directory_tree[0]) ;
>> > print( $directory_tree['path'][0]) ;
>> >
>> >
>>
>> Try:
>>
>> print($directory_tree[0]['path']);
>>
>> Zilla.
>
>

 

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

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