Object and array of mutual transformation in development is also very common, generally not multidimensional case direct (array) and (object) can be done, multidimensional words, traversal can also be:
/** * Object and Array conversions * @link http://www.phpddt.com php sharing Platform * * classTest{ Public$a; Public$b; Public function__construct($a) {$this->a =$a; }}//object to array, using Get_object_vars to return an array of object properties functionobjecttoarray($obj){$arr= Is_object ($obj) ? Get_object_vars ($obj) :$obj;if(Is_array ($arr)){returnArray_map (__function__,$arr); }Else{return$arr; }}//Array to Object functionarraytoobject($arr){if(Is_array ($arr)){return(object) Array_map (__function__,$arr); }Else{return$arr; }}$test=NewTest (' test1 ');$test->b =NewTest (' Test2 ');p Rint_r ($test);$array= Objecttoarray ($test);p Rint_r ($array);$object= Arraytoobject ($array);p Rint_r ($object);
Original address ...
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the PHP objects and arrays of mutual transformation, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.