Array
(
[0] => Array
(
[A] => Demo 1
[B] => Demo 2
[C] => Demo 3
[D] => Demo 4
)
[1] => Array
(
[A] => Sample 1
[B] => Sample 2
[C] => Sample 3
[D] => Sample 4
)
)
Find the column key like as (A,B,C,D)
It's possible to do it by merging by array_merge and then extract the keys by array_keys
$res = array();
foreach($array as $sub) {
$res = array_merge($res, $sub);
}
$keys = array_keys($res);
print_r($keys);
This will output:
Array
(
[0] => A
[1] => B
[2] => C
[3] => D
)
Make use of array_keys() function on each array element
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.