PHP实现多维数组转字符串和多维数组转一维数组的方法,多维维数
本文实例讲述了PHP实现多维数组转字符串和多维数组转一维数组的方法。分享给大家供大家参考。具体实现方法如下:
/** * @method 多维数组转字符串 * @param type $array * @return type $srting * @author yanhuixian */ function arrayToString($arr) { if (is_array($arr)){ return implode(',', array_map('arrayToString', $arr)); } return $arr; } /** * @method 多维数组变成一维数组 * @staticvar array $result_array * @param type $array * @return type $array * @author yanhuixian */ 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; }
希望本文所述对大家的php程序设计有所帮助。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download
The most popular open source editor

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment