fork(1) download
  1. <?php
  2.  
  3. $arr = array(array('nome' => 'fulano'), array('nome' => 'beltrano'), array('nome' => 'doge') );
  4.  
  5.  
  6. $chaves = array_map(function($item){ return $item['nome']; }, $arr);
  7.  
  8. $novo = array_fill_keys($chaves, 0);
  9.  
  10. print_r($novo);
Success #stdin #stdout 0.01s 82880KB
stdin
Standard input is empty
stdout
Array
(
    [fulano] => 0
    [beltrano] => 0
    [doge] => 0
)