Are there any best practices for formatting and outputting arrays in PHP?

When outputting arrays in PHP, it is important to format them in a readable and organized manner for easier debugging and understanding. One common best practice is to use the `print_r()` or `var_dump()` functions to display the contents of an array in a structured format. Additionally, you can use `echo` statements with `foreach` loops to iterate through the array and display each element individually.

// Example of formatting and outputting an array in PHP

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

// Using print_r() to display the array in a structured format
echo "Using print_r(): <br>";
echo "<pre>";
print_r($array);
echo "</pre>";

// Using var_dump() to display the array with more detailed information
echo "Using var_dump(): <br>";
echo "<pre>";
var_dump($array);
echo "</pre>";

// Using foreach loop to iterate through the array and display each element
echo "Using foreach loop: <br>";
foreach ($array as $value) {
    echo $value . "<br>";
}