I've tried a few different ways and per Is it possible to use php functions inside heredoc? it seems like the first one (for the GET) should work?
But it doesn't. Any way to do this simply, or should I just manually include the debug section?
function bottom_module() {
$print_r = print_r;
$html = <<<"OUTPUT"
<footer>
...
</footer>
<aside id="debug">
<hr>
<h3>Debug Area</h3>
<pre>
GET Contains:
{$print_r($_GET)}
POST Contains:
$print_r($_POST)
SESSION Contains:
print_r($_SESSION)
</pre>
</aside>
</body>
</html>
OUTPUT;
echo $html;
}
CodePudding user response:
What you will probably find is that the print_r()
is displaying the value rather than including it in the output.
You should try using the second parameter which if set to true will return the value as a string instead...
<pre>
GET Contains:
{$print_r($_GET, true)}
EDIT from OP for clarity: this solves the issue but as another reply said, $print_r must be declared as $print_r = 'print_r';