检索数组二维php

时间:2017-10-24 06:36:30

标签: php

我已经创建了这样的数组二维,以及我如何能够回溯数组二维

   stdClass Object
(
    [error_code] => 0
    [error_desc] => 
    [data] => Array`enter code here`
        (
            [0] => stdClass Object
                (
                    [nama_mahasiswa] => STANY SUMARNA
                    [jenis_kelamin] => L
                    [tanggal_lahir] => 1996-07-31                    
                    [nama_status_mahasiswa] => AKTIF
                    [nim] => 16304117
                    [id_periode] => 20161               
                )
            [1] => stdClass Object
                (
                    [nama_mahasiswa] => ADAM
                    [jenis_kelamin] => L
                    [tanggal_lahir] => 1996-07-31                    
                    [nama_status_mahasiswa] => AKTIF
                    [nim] => 16304117
                    [id_periode] => 20161               
                )
[2] => stdClass Object
                (
                    [nama_mahasiswa] => STANY SUMARNA
                    [jenis_kelamin] => L
                    [tanggal_lahir] => 1996-07-31                    
                    [nama_status_mahasiswa] => AKTIF
                    [nim] => 16304117
                    [id_periode] => 20161               
                )
)

1 个答案:

答案 0 :(得分:0)

尝试以下代码 让我们说$ array = main array

$error_code = $array->error_code;
foreach($array->data as $row){
    $nama_mahasiswa = $row->nama_mahasiswa;
    $jenis_kelamin = $row->jenis_kelamin;
}