PHP implements multidimensional array to string and multidimensional array to one-dimensional array method, multidimensional dimension _php Tutorial

Source: Internet
Author: User
Tags array to string

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. ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.