Bytes --------------------------------------------------------------------------------------------------------
Array array_map (callable$callback, Array$arr1[, Array$...])
Array_map () returns an array containingarr1All units incallbackThe Unit after the function.
callbackThe number of accepted parameters should be the same as the number of arrays passed to the array_map () function.
Function fun ($ n) {return $ N * $ N;} $ A = array (1, 2, 3, 4, 5 ); $ B = array_map ('fun ', $ A);/* Each array Unit performs a cubic operation and returns an array */print_r ($ B );
/*
Array
( [0] => 1 [1] => 8 [2] => 27 [3] => 64 [4] => 125)
*/
Array_map ('unlink', glob ('*. txt '));/* Glob returns an array composed of "file name .txt" and then deletes each file */
array_map(‘unlink‘, glob(‘*.*‘));
array_map(‘unlink‘, glob(‘*‘));
If array_map () is not used, operations on each cell in the array can only be traversed and assembled as appropriate.
[Email protected] Black Eye poet <www. chenwei. ws> ---------------------------------