Home Backend Development PHP Tutorial 【PHP】array_walk_recursive — 对数组中的每个成员递归地施用用户函数

【PHP】array_walk_recursive — 对数组中的每个成员递归地施用用户函数

Jun 13, 2016 am 10:40 AM
array

【PHP】array_walk_recursive — 对数组中的每个成员递归地应用用户函数
PHP里有这么一个函数:
bool array_walk_recursive ( array &$input , callback $funcname [, mixed $userdata ] )
对数组中的每个成员递归地应用用户函数,可以用来处理多维数组内数据,需要批处理数组内数据的时候使用这个函数非常方便。

1

function gb2312_to_utf8(&$value, $key) {     $value = iconv('gb2312', 'utf-8', $value);}array_walk_recursive($array, 'gb2312_to_utf8');

Copy after login

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Sort array using Array.Sort function in C# Sort array using Array.Sort function in C# Nov 18, 2023 am 10:37 AM

Sort array using Array.Sort function in C#

Simple and clear method to use PHP array_merge_recursive() function Simple and clear method to use PHP array_merge_recursive() function Jun 27, 2023 pm 01:48 PM

Simple and clear method to use PHP array_merge_recursive() function

How to use the array_combine function in PHP to combine two arrays into an associative array How to use the array_combine function in PHP to combine two arrays into an associative array Jun 26, 2023 pm 01:41 PM

How to use the array_combine function in PHP to combine two arrays into an associative array

Detailed explanation of PHP array_fill() function usage Detailed explanation of PHP array_fill() function usage Jun 27, 2023 am 08:42 AM

Detailed explanation of PHP array_fill() function usage

How to use the Array module in Python How to use the Array module in Python May 01, 2023 am 09:13 AM

How to use the Array module in Python

What are the common causes of ArrayStoreException in Java? What are the common causes of ArrayStoreException in Java? Jun 25, 2023 am 09:48 AM

What are the common causes of ArrayStoreException in Java?

Introduction to how to use the PHP array_change_key_case() function Introduction to how to use the PHP array_change_key_case() function Jun 27, 2023 am 10:43 AM

Introduction to how to use the PHP array_change_key_case() function

What are the common causes of ArrayIndexOutOfBoundsException in Java? What are the common causes of ArrayIndexOutOfBoundsException in Java? Jun 24, 2023 pm 10:39 PM

What are the common causes of ArrayIndexOutOfBoundsException in Java?

See all articles