How do you style var_dump()?

This does not color the var_dump() output red:

echo"<br><span style='color:red'>" . var_dump($sql) . "</span><br>";

What’s the correct syntax?

According to the var_dump docs, it doesn’t return value. Instead, it outputs directly to the browser. Which means you’ll either have to write it this way:

echo “<br><span style=‘color:red’>”;
var_dump($sql);
echo “</span><br>”;

Or, you could capture the var_dump’s output using the output buffer functions.

[FONT=Courier New]ob_start();
var_dump($sql);
$varDumpResult = ob_get_clean();

echo “<br><span style=‘color:red’>” . $varDumpResult . “</span><br>”;[/FONT]

Pretty nice! Thanks for helping!

print_r($var, true);