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
==================
Navigation:
[Reply to this message]
|