Tárraga Tárraga - 5 months ago 21
PHP Question

PHP array_diff output

I am using array_diff correctly to compare 2 arrays.

In documentation, it says the output is like this:

Array
(
[1] => blue
)


As you can see, each output will come in a single line.

But when I try it, it only shows me output in 1 line.

enter image description here

Maybe now can be a little friendly, because I only have 4 rows to compare, but I'm supposed to have, in the future, hundreds of them.

How could I solve this?

Answer

You can "pretty print" your array:

echo "<pre>";
print_r($myArray);
echo "</pre>";