What are some best practices for formatting and outputting array elements in PHP?

When outputting array elements in PHP, it's important to format them in a readable and organized way to make the data easily understandable for users. One best practice is to use a loop, such as a foreach loop, to iterate through the array and output each element individually. Additionally, consider using HTML formatting or adding separators between elements to improve readability.

<?php
$array = [1, 2, 3, 4, 5];

foreach ($array as $element) {
    echo $element . "<br>";
}
?>