From e3e1b80869dff2cfce44b3bb00f7b01462c30791 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Thu, 3 Nov 2005 10:45:48 +0000 Subject: [PATCH] __set_state magic method (bug #33203) git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@199894 c90b9560-bf6c-de11-be94-00142212c4b1 --- language/oop5/magic.xml | 15 ++++++- reference/var/functions/var-export.xml | 55 ++++++++++++++++++++++++-- 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/language/oop5/magic.xml b/language/oop5/magic.xml index 96bc0fe345..4b33229168 100644 --- a/language/oop5/magic.xml +++ b/language/oop5/magic.xml @@ -1,5 +1,5 @@ - + Magic Methods @@ -16,6 +16,7 @@ __sleep, __wakeup, __toString, + __set_state, __clone and __autoload are magical in PHP classes. You @@ -166,6 +167,18 @@ echo "text $class"; + + + <literal>__set_state</literal> + + This static method is called + for classes exported by var_export since PHP 5.1.0. + + + The only parameter of this method is an array containing exported + properties in the form array('property' => value, ...). + + + @@ -55,6 +55,32 @@ + + &reftitle.changelog; + + + + + + &Version; + &Description; + + + + + 5.1.0 + + Possibility to export classes and arrays containing classes using the + __set_state magic + method. + + + + + + + + &reftitle.examples; @@ -98,6 +124,29 @@ echo $v; + + + + + + Exporting classes since PHP 5.1.0 + +var = 5; +var_export($a); +?> +]]> + + &example.outputs; + + 5, +)) ]]> @@ -108,8 +157,8 @@ echo $v; &reftitle.notes; - Variables of type resource and arrays or objects containing - objects couldn't be exported by this function. + Variables of type resource couldn't be exported by this + function.