I would like to find out the location in the array where I have store an object.
I have the following code as example:
Expand|Select|Wrap|Line Numbers
- <?php
- class test{
- public static $object_store = array();
- public function start_object($class_name){
- self::$object_store[$class_name] = new $class_name;
- return self::$object_store[$class_name];
- }
- public function locate($class_name){
- self::$object_store[$class_name]->where_am_i();
- }
- }
- class sub{
- public function where_am_i(){
- ##Determine the location where this instance is stored
- ##and output the location, ie: self::$object_store['sub']
- }
- }
- $a = new test;
- $a->start_object("sub");
- $a->locate("sub");
- ?>