Reply to Re: arrays containing class types

Your name:

Reply:


Posted by Jerry Stuckle on 10/06/05 19:17

Oli Filth wrote:
> mungflesh wrote:
>
>>I am new to PHP. Can I define an array in PHP 4.3 containing class
>>types?
>>
>>ie. (simplified example)
>>
>>class MyType
>>{
>> function MyFunc()
>> {
>> $newType = new MyType;
>> this->$array_MyType[] = $newType;
>> }
>>}
>>
>>I am getting an error "Cannot use [] for reading"
>>
>
>
> I would check the syntax for "this", if I were you...
>

It should be

$this->array_MyType = array();
$this->array_MyType[] = $newtype;

(Assuming $array_MyType is a class variable)


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[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

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