A Cleaner Gentler PHP Variable Dump

Sure. Some structures, like an object with member arrays, will have you in a straight-jacket long before you determine where a particular value falls within the structure and how you should construct a reference to it.

Next time, try this:


print('<pre>').print_r($myarray,1).('<pre>');

The results are astonishingly different...


<pre>
Array
(
[0] => Array
(
[0] => Array
(
[0] => apple
[1] => orange
[2] => banana
)

[1] => Array
(
[0] => apple
[1] => orange
[2] => banana
)

)

[1] => Array
(
[0] => apple
[1] => orange
[2] => banana
)

[2] => Array
(
[0] => Array
(
[0] => apple
[1] => orange
[2] => banana
)

[1] => Array
(
[0] => apple
[1] => orange
[2] => banana
)

)

)
</pre>

2 comments

by osinamea (not verified) on Fri, 05/20/2011 - 21:15

i tend to just view source or inspect element in firebug

by J Ayen Green on Sun, 07/10/2011 - 22:25

View php variables in source/firebug??

Post new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.
Design by Ayen Designs. Underlying Drupal theme by Kiwi Themes.