How to get a value within an array

Asked

Viewed 56 times

1

array(3) {
     ["recebidos"]=>
      array(16) {
        [0]=>
        array(25) {
          ["contratante_id"]=>
          int(1028)
          ["datacadastro"]=>
          string(20) "2019-08-01T12:30:44Z"
          ["observacoes"]=>
          NULL
          ["situacaoantiga"]=>
          string(5) "Ativo"
          ["turma_id"]=>
          int(1672)
          ["mataluno_id"]=>
          int(3157)
          ["horarioentrada"]=>
          NULL
    }

1 answer

0

Sergio, you have a multidimensional array.

To access the information you can work with foreach(), for example.

    foreach($recebidos as $p => $kp){

            extract($recebidos[$p]);

            echo $contratante_id . '<br>';
            echo $datacadastro . '<br>';
            echo $observacoes . '<br>';


}

There are other ways to solve what you need. The top one solves your problem, as the array you posted.

I hope I’ve helped

Browser other questions tagged

You are not signed in. Login or sign up in order to post.