Alternative to print_r in Drupal
When developing modules, you often won't have the ability to output data structures to the screen using the Devel module's dsm() function because the devel module may not have yet loaded at the time you attempt to call dsm().
Here is a clean way to use print_r. The output is formatted in a much nicer way.
drupal_set_message(''. print_r($datastructure, true) .'
');