![Contoh Ambil data dari Array Bertingkat](https://ullilfahri.b-cdn.net/storage/app/photos/ullil.png)
Contoh Ambil data dari Array Bertingkat
Contoh Data
?php
$dataDosen = array(
0 => array(
"_id" => "data_dosen-ac5c962d3a87074aba8e727f4e76416b-2191-300424",
"_rev" => "1-580ad1678b8ddba853a390362a96ce96",
"table" => "data_dosen",
"data" => array(
"nomor_registrasi" => 1015119304,
"nama" => "ANJELI RATIH SYAMLINGGA PUTRI",
"jenis_kelamin" => "P",
"agama" => "Islam",
"status" => "Aktif",
"tanggal_lahir" => "BATAM, 15 November 1993",
"urut" => 2191
)
),
1 => array(
"_id" => "data_dosen-f7a46c9b2bcb67f7a3528a7f766f1b7c-2189-300424",
"_rev" => "1-ffe1a432f9c254349fb8116831c40a75",
"table" => "data_dosen",
"data" => array(
"nomor_registrasi" => 8829010016,
"nama" => "SUHARMIYATI",
"jenis_kelamin" => "P",
"agama" => "Islam",
"status" => "Aktif",
"tanggal_lahir" => "RENGAT, 27 July 1974",
"urut" => 2189
)
)
);
// Menampung data ID dan data dosen dalam array baru
$dataDosenBaru = array();
foreach ($dataDosen as $key => $value) {
$idDosen = $value["_id"];
$dataDosenBaru[$key]["id"] = $idDosen;
foreach ($value["data"] as $k => $v) {
$dataDosenBaru[$key][$k] = $v;
}
}
// Menampilkan array data dosen baru
print_r($dataDosenBaru);
?>
Lanjut Part : 1
Muhammad Ullil Fahri
WA : 089696380422
Tautan WA : https://wa.me/message/SG4YA2XQP5FPE1