From 982b0ff3f6020726eed0e75638fa8d0f4f179419 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Tue, 20 Sep 2005 12:50:10 +0000 Subject: [PATCH] Sleep and wakeup example (bug #34397) git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@196444 c90b9560-bf6c-de11-be94-00142212c4b1 --- language/oop5/magic.xml | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/language/oop5/magic.xml b/language/oop5/magic.xml index 5a3e3fa135..96bc0fe345 100644 --- a/language/oop5/magic.xml +++ b/language/oop5/magic.xml @@ -1,5 +1,5 @@ - + Magic Methods @@ -60,6 +60,44 @@ during serialization and perform other reinitialization tasks. + + Sleep and wakeup + +server = $server; + $this->username = $username; + $this->password = $password; + $this->db = $db; + $this->connect(); + } + + private function connect() + { + $this->link = mysql_connect($this->server, $this->username, $this->password); + mysql_select_db($this->db, $this->link); + } + + public function __sleep() + { + mysql_close($this->link); + } + + public function __wakeup() + { + $this->connect(); + } +} +?> +]]> + +