How do i print an Array readable? print_r($array); and var_dump($array); both produce some very ugly clutter of that $array. Ok it is what it says, it prints that array, but i'd like to have some well formated print of that array, how do i do that?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
if you want to see it well formatted, you can encode it to json object and print it pretty :)
You have to do is:
try this code
I like:
var_export()
is usable (copy/paste) PHP code as well.Actually, it is well-formatted but HTML ignores line breaks and double spaces.
You just have to view the page's source code (CTRL+U or right-click > view source code)
You can wrap your
var_dump()
output in<pre>
to preserve the monospacing: