How to read items from one array inside another?

-2

This is my multidimensional array:

<?php  
  $beneficiarios = array
        (


            array(

                "codigo_membro" =>$cod,
                "nome" => $_POST['nome1'],
                "n_identificacao" => $_POST['n_identificacao1'],
                "parentesco" => $_POST['parentesco1'],
                "telefone" => $_POST['telefone1'],
                "email" => $_POST['email1']
            ),
            array(
                "codigo_membro" => $cod,
                "nome" => $_POST['nome2'],
                "n_identificacao" => $_POST['n_identificacao2'],
                "telefone" => $_POST['telefone2'],
                "email" => $_POST['email2']
            )


        );

?>

I would like to read the elements within each array in the multidimensional array.

For example: I would like to be able to print what is written 'name' for each array.

I think maybe a loop of repetition applies, but I'm out of ideas I tried:

<?php echo $beneficiarios[0][1]?>

But it is giving error.

    
asked by anonymous 19.10.2018 / 15:09

1 answer

0

I made some adjustments to this code and got the result. I would like to share. (example code)

    <?php

  $Array = array(
   array("Conta" => "FRANCIELE OLIVEIRA", "CPF" => "", "TelefoneRes"=> '(00) 0000-0000'),
   array("Conta" => "BEATRIX BEHN", "CPF" => "", "TelefoneRes"=> '(00) 0000-0')
                                                        );
$i = 0;
foreach ($Array as $result):
       $i++;
 extract($result);
 ?>
 <tr>
 <td class="text-left col-md-9 control-label"> <?php echo $Conta ?></td>
 <td class="text-left col-md-9 control-label"> <?php  echo $CPF ?></td>
 <td class="text-left col-md-9 control-label"> <?php echo $TelefoneRes ?></td>

</tr>
    <?php
endforeach;
               ?>
 Thank you in advance for your attention.     
19.10.2018 / 16:52