Skip to content

Instantly share code, notes, and snippets.

@DanBeckett
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanBeckett/29dfcfe2788ca16b6af2 to your computer and use it in GitHub Desktop.
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.
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