-1

I have an array like the one below in laravel which I want to fetch the column.

Array
(
    [0] => Array
        (
            [table] => form_identification
            [column] => region
        )

    [1] => Array
        (
            [table] => form_identification
            [column] => province
        )

)

And I want the output like this

Array
(
    [0] => Array
        (
            [column] => region
        )

    [1] => Array
        (
            [column] => province
        )

)
mickmackusa
  • 43,625
  • 12
  • 83
  • 136
Dexter
  • 3
  • 2

1 Answers1

1

Consider your first array as $datas variable here and we are using for each whole array

foreach($datas as $data) {
    $result[] = array('column' => $data['column']);
}
print_r($result);
mickmackusa
  • 43,625
  • 12
  • 83
  • 136
Faizan
  • 86
  • 13