Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use array_walk_recursive function in php

Shulou Source: shulou.com Published: 2022-05-31 10:56:54 09月15日 Update

This article mainly introduces "how to use array_walk_recursive function in php". In daily operation, I believe many people have doubts about how to use array_walk_recursive function in php. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to use array_walk_recursive function in php". Next, please follow the editor to study!

1. Description

The array_walk_recursive function is used to deal with two-dimensional arrays, which recursively applies the user function to each member of the array.

2. Grammar

Array_walk_recursive (array,myfunction,parameter...)

3. Parameters

Array is required.

Myfunction is required.

Parameter,... Optional.

4. Return value

Returns TRUE if successful, FALSE otherwise.

5. Examples

Class Test {function testWalk () {$a = ['averse = > 1,' baked = > 2]; $b = [$a, 'cased = > 3,' walk' = > 4]; array_walk_recursive ($a, [$this, 'walk']);} function testMap () {$a = [' averse = > 1, 'baked = > 2]; $b = [$a,' cased = > 3, 'dumped = > 4] Array_walk_recursive ($a, [$this, 'Map']);} function walk (& $v, $k) {$v = pow ($v, 3);} function map ($v) {return pow ($v, 6);}} so far, the study on "how to use array_walk_recursive functions in php" is over, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Functions learning arrays more help practical successful next functions parameters examples members articles methods theories users knowledge articles websites grammar Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Linux Microsoft vpn Shulou Technology