Source: geeksforgeeks.org

Sometimes when coding or debugging in PHP, it’s helpful to see the entire contents of an array. An easy way to do this is with the print_r command. To make it more readable, wrap it in <pre> tags.

For example, to see the contents of associative array $FormData:

<pre><?= print_r($FormData) ?></pre>

You’ll see output like this:

 Array
(
    [CustomerId] => 2
    [Rating] => 5
    [DateOfBirth] => 01/01/1970
    [FirstName] => John
    [LastName] => Smith
    [Address1] => 1 Main St
    [Address2] =>
    [City] => Santa Monica
    [State] => CA
    [PostalCode] => 90201
    [PhoneNumber] =>
)
1