Search code examples
phparray-difference

PHP array_diff format output


I am using array_diff to compare arrays, everything is ok. The format output is:

Array
(
    [1] => blue
    [2] => green
    [7] => yellow
)

Is there any way to format that output? So I only receive

blue
green
yellow

I really appreciate any help you can provide.


Solution

  • You can simply use implode function instead like as

    echo implode("<br>",$your_array);