Making PHP var_dump() values display one line per value

user1320318 picture user1320318 · Apr 12, 2012 · Viewed 117.7k times · Source

When I echo var_dump($_variable), I get one long, wrapping line with all varable's and values like

["kt_login_user"]=>  string(8) "teacher1" ["kt_login_id"]=>  string(3) "973" ["kt_campusID"]=>  string(4) "9088" ["kt_positionID"]=>  string(1) "5" 

Is there a way I can make each value display on its own line for ease of reading? Something like this:

["kt_login_user"]=>  string(8) "teacher1" 
["kt_login_id"]=>  string(3) "973" 
["kt_campusID"]=>  string(4) "9088" 
["kt_positionID"]=>  string(1) "5"

Answer

phirschybar picture phirschybar · Apr 12, 2012

Yes, try wrapping it with <pre>, e.g.:

echo '<pre>' , var_dump($variable) , '</pre>';