Re: Print extended/parent classes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mathijs,

Mathijs wrote:
> I have the following situation :
> 
> <?php
> 
> class A {
> public $var1;
> }
> 
> class B extends A {
> public $var2;
> }
> 
> ?>
> 
> Now I want to print this object
> <?php
> 
> $obj = new B;
> print_r($obj);
> 
> ?>
> 
> Does anybody know how I can print class A also ?

The above prints out:

B Object
(
    [var2] =>
    [var1] =>
)

Is this not what you expected?  You can't print out *just* the
properties of A.  If this isn't what you want, you shouldn't be extending A.

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg    0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

WANTED: Junior PHP Developer in Bristol, UK

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux