Last active
August 29, 2015 14:04
-
-
Save DanBeckett/29dfcfe2788ca16b6af2 to your computer and use it in GitHub Desktop.
Simple function to display an array or object with the pre tags already added.
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 print_with_pre($variable, $show=false) { | |
if($show===true) { | |
$style = ''; | |
} else { | |
$style = ' style="display: none;"'; | |
}; | |
$variable_to_show = print_r($variable, true); | |
$html = '<pre'.$style.'>'.$variable_to_show.'</pre>'; | |
echo $html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment