Thanks. I will ignore it, it is not a big deal in my Development. Was more
curious if where was an easy way :)

I am using PHP4

-----Original Message-----
From: Jochem Maas [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 26, 2006 3:50 PM
To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: [PHP] Only see class member variables, not parent class member
variables

Peter Lauri wrote:
> Hi,
> 
> I have a class B that extends A. When I do print_r($object_b) it outputs
all
> member variables from A and B. I just want to see the variables from B
> excluding the one that B inherits from A, how can I do that? This is just
> for development; I will of course need to use the variables from A to
> actually use the object B.

the short answer is you can't.

the longer answer is you can but writing the code that will extract this
info
is probably gonig to taking alot more time than it's worth.

btw you didn't mention what version of php you're using
but here is some php5 code that relates to your problem:


class One { public $one = 1; protected $_one = 1; function myprops() {return
get_object_vars($this);} }
class Two extends One { public $two = 2; protected $_two = 2; }
$t = new Two; $o = new One;
var_dump($t, (array)$t, get_object_vars($t), $t->myprops(), $o->myprops(),
get_class_vars("Two"));

also read this page for more info:
http://php.net/manual/en/function.get-class-vars.php

> 
> Best regards,
> Peter Lauri
> 

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

Reply via email to