]> git.mjollnir.org Git - moodle.git/commitdiff
Add a new function fullclone() to forcibly make a complete copy of a structure
authormoodler <moodler>
Wed, 26 Apr 2006 04:39:34 +0000 (04:39 +0000)
committermoodler <moodler>
Wed, 26 Apr 2006 04:39:34 +0000 (04:39 +0000)
lib/moodlelib.php

index 13b34651987a7470d4fe5bc04e811669604c5d64..7c9e37e33f254eb14364967dc94df4ea84d7aed2 100644 (file)
@@ -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