From 35ca0d6a45abcc90771e74ae20785848f35ebbdc Mon Sep 17 00:00:00 2001 From: moodler Date: Wed, 26 Apr 2006 04:39:34 +0000 Subject: [PATCH] Add a new function fullclone() to forcibly make a complete copy of a structure --- lib/moodlelib.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 -- 2.39.5