Last active
January 10, 2019 12:42
-
-
Save panayotoff/5c3cbeee3c5f45ed17d36b044d4bcf48 to your computer and use it in GitHub Desktop.
Helper to pretty output variable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pre($var){ | |
$styles = [ | |
'display:block', | |
'padding:1em', | |
'margin:1em', | |
'border-radius:3px', | |
'font-size:14px', | |
'font-family: monospace', | |
'white-space: pre-wrap', | |
'word-wrap: break-word', | |
'overflow-x:auto', | |
'color: #004267', | |
'border:1px solid #00426733', | |
'box-shadow: 0 1px 1px rgba(0,0,0,0.08)', | |
'line-height:1.5em', | |
'text-align:left', | |
'white-space:pre', | |
'overflow-x:auto', | |
'background-image: linear-gradient(180deg, #eaeaea 50%, #fff 50%)', | |
'background-size: 100% 3em', // Double the line height | |
'background-position: 0 1em;' // Offset by top padding | |
]; | |
echo sprintf('<pre style="%s">%s</pre>', | |
implode(';', $styles), | |
var_export($var, true) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment