note 19169 deleted from function.array-key-exists by danbeck

From: Date: Wed, 13 Mar 2002 15:54:04 +0000
Subject: note 19169 deleted from function.array-key-exists by danbeck
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-27737@lists.php.net to get a copy of this message
Argh!! I would really like it to pass by address... doing something like the following would be awesome for my purposes. As it is you sort of accomplish this by simply registering the objects with the session and putting the class destruction code in the __sleep function, which is actually just a nasty sort of hack. register_shutdown_function( "destroy_objects" ); function destroy_objects() { $arr = get_defined_vars(); for( $i = 0; $i < count( $arr ); $i++ ) { if( is_object($arr[ $i ]) ) { $methods = get_class_methods( get_class($arr[$i]) ); if( array_key_exists("class_Destroy", $methods) ) { $arr[$i]->class_Destroy(); } } } }

« previous php.notes (#27737) next »