3v4l.org

run code in 300+ PHP versions simultaneously
<?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);

preferences:
94.88 ms | 405 KiB | 5 Q