Jump to content

print_r() : how to display it vertically ?


bobohob

Recommended Posts

How to display the result of print_r vertically ?

 

It display like this (horizontal) :

Array ([0] => fruit [1] => animal [2] => machine )

 

I was hoping it would display vertically :

(see the image below) or http://au.php.net/print_r

 

Thanks.

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/67403-print_r-how-to-display-it-vertically/
Share on other sites

the nl2br version won't indent but pre tags will

 

<?php
$ar = array (
          'abc' => array (1,2,3),
          'def' => array (7,8,9)
        );
        
echo '<pre>', print_r($ar, true), '</pre>';
?>

 

Array
(
    [abc] => Array
        (
            [0] => 1
            [1] => 2
            [2] => 3
        )

    [def] => Array
        (
            [0] => 7
            [1] => 8
            [2] => 9
        )

)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.