Skip to content

Instantly share code, notes, and snippets.

@Jul10l1r4
Created December 12, 2017 00:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jul10l1r4/9660f5a0876fd047066635fe3a37481d to your computer and use it in GitHub Desktop.
Save Jul10l1r4/9660f5a0876fd047066635fe3a37481d to your computer and use it in GitHub Desktop.
<?php
$users = [
[ 'idade' => 29, 'nome' => 'Marcos lucim' ],
[ 'idade' => 20, 'nome' => 'Marcos ' ],
[ 'idade' => 50, 'nome' => 'Marcelo dougras' ],
];
function passa ( $val ){
return $val[ 'nome' ];
}// Isso é uma função pura :)
$val_saida = array_map( "passa", $users );
// Aqui meu array map vai usar a função no array, ele poderia fazer outras coisas
print_r($val_saida);
//print_r no caso é para que possa ter uma saída
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment