Alternative to print_r in Drupal

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) .'
');

Related Posts

Thoughts from BADCamp: A Shift From Drupal Services To Drupal Products

Brent Bice
Read more

Drupal Gardens will make Drupal easier to use

Frankie DeSoto
Read more

The Ultimate Drupal Guide, Part 1: Where to get Direct Help

Sean Keeley
Read more

Drupal In a Box - Creating really custom functionality within Drupal 7

Ahmad Kharbat
Read more

2009 was the Year of the Drupal

Chris Sloan
Read more

Tuning Drupal Performance on DigitalOcean

Kyle Taylor
Read more