There is a small quirk in it, obviously it first does the var_dump if its in the same line with other commands.
Example:
<?php
$array = array(1,2,3);
// Does not work? Shows first the var_dump, then <pre>
echo "<pre>" . var_dump($array);
// Works perfectly as intended
echo "<pre>";
echo var_dump($array);
?>
Also, output control is not the best way to catch the output, instead, using
$output = var_export($variable,TRUE);
fills the $output variable with just the same. See the var_export() documentation for details.
unset