Wednesday, June 17, 2015

Better PHP Logging

If you are doing any kind of PHP development you will no doubt need to log out some values. Unlike JavaScript, logging out to the browser developer tools isn’t possibly as PHP is a server side language.

Thankfully with a tiny bit of markup wrapping your var_dump or print_r statement you can easily read information about the variable.


<?php

echo "<pre>"; 
var_dump($your_variable); 
echo "</pre>";

?>

Or


<?php

echo "<pre>"; 
print_r($your_variable); 
echo "</pre>";

?>


The post Better PHP Logging appeared first on Web Design Weekly.


by Jake Bresnehan via Web Design Weekly

No comments:

Post a Comment