From: moodler Date: Wed, 26 Apr 2006 04:39:34 +0000 (+0000) Subject: Add a new function fullclone() to forcibly make a complete copy of a structure X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=35ca0d6a45abcc90771e74ae20785848f35ebbdc;p=moodle.git Add a new function fullclone() to forcibly make a complete copy of a structure --- diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 13b3465198..7c9e37e33f 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -6801,6 +6801,18 @@ eval(' '); } + +/** + * This function will make a complete copy of anything it's given, + * regardless of whether it's an object or not. + * @param mixed $thing + * @return mixed + */ +function fullclone($thing) { + return unserialize(serialize($thing)); +} + + /** * If new messages are waiting for the current user, then return * Javascript code to create a popup window