Re: [PHP] OOP class names

2002-10-02 Thread Debbie Dyer

I told you something incorrectly yesterday:-

- From what you say you dont want get_class_name because this gives you
the name of the class not the instance of it.

get_class is PHP's function for getting the name of a class not
get_class_name

Sorry - I must have been thinking in Java mode.

Debbie

- Original Message -
From: Davíð Örn Jóhannsson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, October 01, 2002 1:59 PM
Subject: [PHP] OOP class names


 Is there any way to get a print out of class names of an object, lets
 say I have a object called obj and I have x number of classes and I want
 to find out, theyr names, for example obj-class1 obj-class2 etc.

 Thanks David



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




Re: [PHP] OOP class names

2002-10-01 Thread Debbie Dyer

From what you say you dont want get_class_name because this gives you the
name of the class not the instance of it - which is really no different from
asking how to get the name of any var.

I dont really know why you would want to do this unless you are dynamically
naming the objects.

There is get_defined_vars but this gives you everything, environment vars
etc and u would have to go through the lot.

I am assuming you have the objects in some sort of container - because if
you dont know their names that is the only way you can access them - so the
only way I can think of is how you name them in the first place.

eg. use the name as the key in the container

  $arr = array();
  for ($i = 0; $i  10; $i++) {
$name = classname$i;
$$name = new blah();
$arr[$name] = $$name;
  }

Maybe there's another way but I cant think of one.

Debbie


- Original Message -
From: Davíð Örn Jóhannsson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, October 01, 2002 1:59 PM
Subject: [PHP] OOP class names


 Is there any way to get a print out of class names of an object, lets
 say I have a object called obj and I have x number of classes and I want
 to find out, theyr names, for example obj-class1 obj-class2 etc.

 Thanks David



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