Re: [PHP4BETA] Classes broken?
| From: | Chad | Date: | Mon, 15 Nov 1999 15:53:54 +0000 |
| Subject: | Re: [PHP4BETA] Classes broken? | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-6245@lists.php.net to get a copy of this message | ||
Faisal Nasim wrote:
> class Blah
> {
> var $mysinglevar;
> }
>
> $pointer = new Blah;
> $pointer -> anything_i_want = "Not good!";
>
> print $pointer -> anything_i_want;
I'll defer this to the experts, but suffice it to say php is not a
strict OO language, so you're only going to get so much :)
> class Class1
> {
> var $myvar;
> var $childclass;
> }
>
> class Class2
> {
> var $age;
> var $name;
> var $etc;
> }
>
> $mainthread = new Class1;
> $mainthread -> childclass = new Class2;
> $mainthread -> childclass -> age = "1241";
>
> The Class2 is useless in the above case.
This should work...
> Also, I would like to know if there is a quick and easy way
> to determine what "class" the variable is associated to?
> PHP is an interpreted language, and it think it does (or should?)
> allow this.
Here are some fun zend functions:
get_class($object) - get classname
get_parent_class($object) - get parent classname
method_exists($object, "classname") - check if classname exists in $object