-4

I have output like this:

[0] => Array
    (
        [voice] => Napisy
        [quality] => 720
        [source] => YouTube
    )
[16] => Array
    (
        [voice] => Napisy
        [quality] => 720
        [source] => Mega
    )

And I want to get source to get output [Youtube, Mega]. Anyone know how to get this without foreach?

3
  • Show us what you have tried, show some code. Please rephrase your question, its not clear what you mean. Commented Oct 18, 2019 at 11:19
  • @Grumpy I want to get from this array "Source" and output in array [Mega, YouTube] Commented Oct 18, 2019 at 11:20
  • @Kokosadk Without foreach, so use array_column(). There are tons of duplicates on this. Search through them. Commented Oct 18, 2019 at 11:22

1 Answer 1

0

You can get source from whole array into another array using array_column.

your above array is $array

$source = array_column($array, 'source');
print_r($source);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.