- print_r: documentation ( source)
- array_keys: documentation ( source)
<?php
$arr[] = ["_source" => ["block" => ["Kurud"], "district" => ["Dhamtari"], "state" => ["Chhattisgarh"]]];
$arr[] = ["_source" => ["block" => ["North-Bangeluru"], "district" => ["Bangalore"], "state" => ["Karnataka"]]];
$keys = array_keys($arr[0]["_source"]);
$res[] = $keys;
foreach($arr as $e) {
$temp = [];
foreach($keys as $k)
$temp[] = $e["_source"][$k][0];
$res[] = $temp;
}
print_r($res);