PHP7中文手册2018 带注释 最新chm版
- $array = array
- (
- array
- (
- 'action' => 'A',
- 'id'=> 1,
- 'validate' => 'yes',
- 'Base' => array
- (
- 'id' => 2945,
- ),
- 'EBase' => array
- (
- 'id' => 398,
- ),
- 'Qty' => 1,
- 'Type'=> array
- (
- 'id' => 12027,
- ),
- 'Label' => 'asfhjaflksdkfhalsdfasdfasdf',
- 'Unit' => 'asdfas',
- )
- );
- function getL2Keys($array)
- {
- $result = array();
- foreach($array as $sub) {
- $result = array_merge($result, $sub);
- }
- return array_keys($result);
- }
- print_r(getL2Keys($array));
- /*
- Array
- (
- [0] => action
- [1] => id
- [2] => validate
- [3] => Base
- [4] => EBase
- [5] => Qty
- [6] => Type
- [7] => Label
- [8] => Unit
- )
- */
转载请注明:谷谷点程序 » php找出数组中的键值