PHP implements multidimensional array to string and multidimensional array to one-dimensional array method, multidimensional dimension
In this paper, we describe the method of PHP implementing multidimensional array to string and multidimensional array to one-dimensional array. Share to everyone for your reference. The implementation method is as follows:
/** * @method multidimensional array to String * @param type $array * @return type $srting * @author Yanhuixian */function arraytostring ($arr) { if (Is_array ($arr)) {return implode (', ', Array_map (' arraytostring ', $arr));} return $arr; }/** * @method multidimensional array into a one-dimensional array * @staticvar array $result _array * @param type $array * @return type $array * @author Yanhuixia N * * Function Multi2array ($array) {static $result _array = Array (); foreach ($array as $key + $value) {if (Is_array ($ Value) {Array_multi2array ($value);} else $result _array[$key] = $value; } return $result _array; }
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/1044850.html www.bkjia.com true http://www.bkjia.com/PHPjc/1044850.html techarticle PHP Implementation of multidimensional array to string and multidimensional array to a one-dimensional array of methods, multidimensional dimension in this paper, we describe the method of implementing multidimensional array to string and multidimensional array to one-dimensional array. ...