992Returning output of print_r in PHP

Use it to capture output and print it in one go. For example when debugging server function with an ajax call.

$message = "hello!\n";

$a = array(
  'one' => 1,
  'two' => 2
);

$message .= print_r($a, true);

print_r($output);

prints:


/*
hello!
Array
        (
            [one] => 1
            [two] => 2
)
*/