1

I want to implode every "a_skill" in this array into a string. Usually I would do implode(", ", $my_array); but this is nested. Is there an easy way to handle this?

Array
(
    [0] => Array
        (
            [email] => don.pinkus@gmail.com
            [a_skill] => test
        )

    [1] => Array
        (
            [email] => don.pinkus@gmail.com
            [a_skill] => testerrrr
        )

)

From PHP's array docs, array_keys looks promising but I can't get it to work.

Don P
  • 60,113
  • 114
  • 300
  • 432

1 Answers1

1

If you are using PHP 5.5 then you can use array_column like follows:

$a_skill_array = array_column($my_array, 'a_skill');
echo implode(', ', $a_skill_array);
vee
  • 38,255
  • 7
  • 74
  • 78