显示下拉菜单

Test of array_column() 本页面仅提供英文版本。

Example #1 : test success
Example #2 : test success
Example #1
$input = [
  
=> [
    
=> [
      
'id' => 2135,
      
'first_name' => 'John',
      
'last_name' => 'Doe',
    ],
    
=> [
      
'id' => 3245,
      
'first_name' => 'Sally',
      
'last_name' => 'Smith',
    ],
    
=> [
      
'id' => 5342,
      
'first_name' => 'Jane',
      
'last_name' => 'Jones',
    ],
    
=> [
      
'id' => 5623,
      
'first_name' => 'Peter',
      
'last_name' => 'Doe',
    ],
  ],
  
=> 'first_name',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'array' => [
      
=> 'John',
      
=> 'Sally',
      
=> 'Jane',
      
=> 'Peter',
    ],
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #2
$input = [
  
=> [
    
=> [
      
'id' => 2135,
      
'first_name' => 'John',
      
'last_name' => 'Doe',
    ],
    
=> [
      
'id' => 3245,
      
'first_name' => 'Sally',
      
'last_name' => 'Smith',
    ],
    
=> [
      
'id' => 5342,
      
'first_name' => 'Jane',
      
'last_name' => 'Jones',
    ],
    
=> [
      
'id' => 5623,
      
'first_name' => 'Peter',
      
'last_name' => 'Doe',
    ],
  ],
  
=> 'first_name',
  
=> 'id',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'array' => [
      
2135 => 'John',
      
3245 => 'Sally',
      
5342 => 'Jane',
      
5623 => 'Peter',
    ],
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]