php - How to get a key from an array in anonymous function? -


How do I get a key from an array in unknown functions using 'array_map'?

  array_map (function ($ v) {echo $ v. '& Lt; br / & gt;'; // mill key (container .. etc)}, array ('container' = & Gt; $ this-> Container, 'CONTAINER_USE_KEY' => $ the- & gt; CONTAINER_USE_KEY, 'LINE' => $ this-> line));    

If you select instead of array_walk () You can do this:

  $ data = array ('container' = & gt; $ the- & gt; container, 'CONTAINER_USE_KEY' = & gt; $ This - & gt; CONTAINER_USE_KEY, 'LINE' => $ this-> line); Array_walk ($ data, function ($ key, $ value) {echo $ key. '
'}};

Comments