Problems with PHP array transcoding
Public Function Array_iconv ($in _charset, $out _charset, $arr) {
Return eval (' Return '. Iconv ($in _charset, $out _charset,var_export ($arr, true). '; ');
}
I had this problem when I was transcoding.
Fatal error:call to undefined method stdclass::__set_state () in D:\soft\apache\htdocs\webtest\arrayiconv.func.php (5): Eval () ' D code on line 1
------Solution--------------------
The manual has:
_set_state ()
Static object __set_state (array $properties)
This static method is called when Var_export () is called (Valid from PHP 5.1.0).
The only parameter to this method is an array that contains the by array (' property ' = = value, ...) The class properties of the format arrangement.
Example #4 using __set_state () > (PHP 5.1.0 and later support)
PHP Code
var1 = $an _array[' var1 ']; $obj->var2 = $an _array[' var2 '); return $obj; }} $a = new A; $a->var1 = 5; $a->var2 = ' foo '; eval (' $b = '. Var_export ($a, true). ';'); $b = a::__set_state (Array ( // ' var1 ' = 5, // ' var2 ' = ' foo ',