Quote:
quote:Originally posted by hmmm
Hi,
I have looked around and I cant find a good way to do this.
The problem is that I store my objects in an associative array (name=>object)
but when I try to access the objects later ,like so;
$tmpObj = $array[$name];
$tmpObj->method($whatever);
it says $tmpObj isnt a method
Any help would be appreciated
Thanks in advance.
|
I'm confused. Are you sure the error is saying that $tmpObj isn't a method? And what do you mean when you say you store your objects in an associate array? Could you post an example of the code you're using?
if $tmpObj is in fact an object, and you want to access an
attribute of that object, you do it this way:
$tmpObj->attribute_name
If you want to access a method, you do it this way:
$tmpObj->method_name()
Arrays are not objects.
http://us3.php.net/manual/en/language.oop.php
http://us3.php.net/manual/en/language.oop5.php