Skip to content

Instantly share code, notes, and snippets.

@salcode
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save salcode/ee54c64ea63e9abcffc2 to your computer and use it in GitHub Desktop.
Save salcode/ee54c64ea63e9abcffc2 to your computer and use it in GitHub Desktop.
One-liner Troubleshooting with print_r()
<?php
...
# output $x (can be an object or array)
# to your page, nicely formatted
echo '<pre>';
print_r( $x );
echo '</pre>';
# record $x (can be an object or array)
# in your PHP error log
error_log( print_r( $x, true ));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment