title: How to output (to a log) a multi-level array in a format that is human-readable?
body: <p>I'm working on a drupal site and when debugging, I am always having to read through long, nested arrays. As a result, a large portion of my life is spent using the arrow, return, and tab keys, to split up 1000+ character strings into a nested, readable format.</p>
  
  <p>For drupal devs, I can't use devel's dsm(), as I'm working with multi-step #ahah/#ajax forms, and I can only output the arrays to the error log, not to the screen.</p>
  
  <p>Visual example:</p>
  
  <p>Evil:</p>
  
  <p><pre>array ( 'form_wrapper' => array ( '#tree' => true, '#type' => 'fieldset', '#prefix' => '', '#suffix' => '', '#value' => '', 'name' => array ( '#type' => 'textfield', '#title' => NULL, '#size' => 60, '#maxlength' => 60, '#required' => false, '#description' => NULL, '#attributes' => array ( 'placeholder' => 'Email', ), '#post' => array ( 'form_wrapper' => array ( 'name' => '', 'pass' => '', ),</pre> ...</p>
  
  <p>Good:</p>
  
  <pre><code>array ( 
  'form_wrapper' =&gt; array ( 
      '#tree' =&gt; true, 
      '#type' =&gt; 'fieldset', 
      '#prefix' =&gt; '&lt;div&gt;', 
      '#suffix' =&gt; '&lt;/div&gt;', 
      '#value' =&gt; '', 
      'name' =&gt; array ( 
          '#type' =&gt; 'textfield', 
          '#title' =&gt; NULL, 
          '#size' =&gt; 60, 
          '#maxlength' =&gt; 60, 
          '#required' =&gt; false, 
          '#description' =&gt; NULL, 
          '#attributes' =&gt; array ( 
              'placeholder' =&gt; 'Email', 
          ), 
  </code></pre>
  
  <p><strong>Edit</strong>: Sorry, by "not output to screen", I meant via drupal's system messages where it's possible to output arrays in a clickable, nested format (using devel.module).</p>