Skip to content

Instantly share code, notes, and snippets.

@joshuapowell
Created April 12, 2011 02:04
Show Gist options
  • Save joshuapowell/914783 to your computer and use it in GitHub Desktop.
Save joshuapowell/914783 to your computer and use it in GitHub Desktop.
Display an array in a readable format, preserving the whitespace, formatting as code, and displaying inside of a Message box.
<?php
/**
* Display an array in a readable format, preserving the whitespace,
* formatting as code, and displaying inside of a Message box. This can
* be placed inside of any function within a Drupal module or theme.
* This is primarily used during troubleshooting and should never be
* used on a production website.
*
* @param $array
* Represents array to be displayed, this could be a node object for instance
*/
drupal_set_message('<code><pre>' . print_r($array, TRUE) . '</pre></code>');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment