Skip to content

Instantly share code, notes, and snippets.

@adrian-enspired
Last active November 28, 2018 02:37
Show Gist options
  • Save adrian-enspired/4b165cd0a1debe39aec6 to your computer and use it in GitHub Desktop.
Save adrian-enspired/4b165cd0a1debe39aec6 to your computer and use it in GitHub Desktop.
print_r() is not helpful (in most cases, but especially for debugging) as it hides useful information from you. observe:
<?php
$a = [
"true",
true,
1,
"1",
"false",
false,
0,
"0",
"a string",
"a string ",
"a \x00\x00\x00string",
"Array
(
[0] => a
[1] => b
[2] => c
)",
"a string
[13] => Array
(
[0] => yeah, this is in fact still the same string as [12]
)"
];
header("Content-type: text/plain");
print_r($a);
var_dump($a);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment