fork download
  1. <?php
  2.  
  3. $array = array();
  4.  
  5. $id = "meu_id";
  6.  
  7. $nomes = ["Aluguel", "Água", "Contabilidade", "Energia",
  8. "Imposto", "IPTU", "Marketing" , "Telefone"];
  9.  
  10. $max = count( $nomes );
  11.  
  12. for( $count = 0; $count < $max; $count++)
  13. {
  14. $array[$count] = array(
  15. 'id_assinante' => $id,
  16. 'nome' => $nomes[$count] );
  17. }
  18. var_dump($array);
Success #stdin #stdout 0.01s 52488KB
stdin
Standard input is empty
stdout
array(8) {
  [0]=>
  array(2) {
    ["id_assinante"]=>
    string(6) "meu_id"
    ["nome"]=>
    string(7) "Aluguel"
  }
  [1]=>
  array(2) {
    ["id_assinante"]=>
    string(6) "meu_id"
    ["nome"]=>
    string(5) "Água"
  }
  [2]=>
  array(2) {
    ["id_assinante"]=>
    string(6) "meu_id"
    ["nome"]=>
    string(13) "Contabilidade"
  }
  [3]=>
  array(2) {
    ["id_assinante"]=>
    string(6) "meu_id"
    ["nome"]=>
    string(7) "Energia"
  }
  [4]=>
  array(2) {
    ["id_assinante"]=>
    string(6) "meu_id"
    ["nome"]=>
    string(7) "Imposto"
  }
  [5]=>
  array(2) {
    ["id_assinante"]=>
    string(6) "meu_id"
    ["nome"]=>
    string(4) "IPTU"
  }
  [6]=>
  array(2) {
    ["id_assinante"]=>
    string(6) "meu_id"
    ["nome"]=>
    string(9) "Marketing"
  }
  [7]=>
  array(2) {
    ["id_assinante"]=>
    string(6) "meu_id"
    ["nome"]=>
    string(8) "Telefone"
  }
}