You are not logged in.
Login
or
Register
.
JsPHP: a JavaScript library providing the PHP API
Home
Register
Demo
Categories
Functions
Contributors
Download
Links
Comments
FAQ
Contact
View
Edit
Benchmark
Revisions
Developers
Dependencies
Talk
Links
array_walk_recursive:
Edit: array_walk_recursive
Function:
array_walk_recursive
View array_walk_recursive
Edit array_walk_recursive
Edit code
Edit tests
Edit benchmark
View latest code
Edit latest code
Benchmark array_walk_recursive
Comment on array_walk_recursive
Comment on the latest code
View revisions
View versions
View contributors
View dependencies
View comments
View links
Download production code
Download development code
View the PHP docs
View phpjs.org
View phpjs.org raw code
Description:
Apply a user function recursively to every member of an array.
Edit function
Code
:
function array_walk_recursive (array, funcname, userdata) { // http://jsphp.co/jsphp/fn/view/array_walk_recursive // + original by: Johnny Mast (http://www.phpvrouwen.nl) // * example 1: array_walk_recursive ({'a': 'b', 'c': {'d': 'e'}}, 'void', 'userdata'); // * returns 1: true // * example 2: array_walk_recursive ('a', 'void', 'userdata'); // * returns 2: false var key; if (typeof array != 'object') { return false; } for (key in array) { if (typeof array[key] == 'object') { return this.array_walk_recursive(array[key], funcname, userdata); } if (typeof(userdata) != 'undefined') { eval(funcname + '( array [key] , key , userdata )'); } else { eval(funcname + '( userdata ) '); } } return true; }
You have to be logged in to edit functions.
[
top
]
Comments
There are no comments yet, be the first!
Please
Login
or
Register
to post comments.