wp_list_pluck

112

$foods = array(
    array(
        'name'  => 'Banana',
        'color' => 'Yellow',
    ),
    array(
        'name'  => 'Apple',
        'color' => 'Red',
    )
);
	
$food_names = wp_list_pluck( $foods, 'name' );

print_r($food_names);

// [ 'Banana', 'Apple']

Comments

Submit
0 Comments