note 19169 added to function.array-key-exists

From: Date: Mon, 18 Feb 2002 16:59:11 +0000
Subject: note 19169 added to function.array-key-exists
Groups: php.notes 
Request: Send a blank email to php-notes+get-26751@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(); } } } } -- http://www.php.net/manual/en/function.array-key-exists.php http://master.php.net/manage/user-notes.php?action=edit+19169 http://master.php.net/manage/user-notes.php?action=delete+19169 http://master.php.net/manage/user-notes.php?action=reject+19169

« previous php.notes (#26751) next »