Skip navigation.
Home

Map

This is a tool to write a small code template for array_walk(). It also demonstrates using JavaScript to generate code -- view source to see this.

Perl has a nice feature called "map". It's similar to array_walk(), except not clunky. It looks like this:

map( function, @array );

OR

map { ... } @array;

This latter form is powerful. You can stack it like this:

map { ... } ( map { ... } @array );

PHP lacks this nice syntax. It does, however, have array_walk(), and that can work in a pinch. Below is a form that writes a little bit of array_walk() code for you. Type a variable name, and press TAB.

Array variable name $