dban00b
asked on
Looking for workaround: print_r and var_export cannot run with ob_start's callback function
the functions print_r() and var_export() cannot be run within my ob_start's callback function because those functions use ob_start() internally. Does anyone know of a workaround so I can simply spit out an array within my callback?
<?php
function mycallback ($buffer){
$array=(1,2,3,4,5);
//neither of these work
$result=print_r($array,true);
$result=var_export($array,true);
$buffer.="<div class=\"debug\">".$result."</div>";
return $buffer;
}
ob_start("mycallback");//buffer on
include("helloworld.html");
ob_end_flush();
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks for the question and the points.
ASKER
No problem, thank you! I messed around with this for an hour or so before giving up and posting here, and you got my the solution in 10 minutes!!
ASKER