Variable Dump to Error Log

PHP Logo
PHP manual on var_dump

This is a brilliant way to dump variables to a webserver’s error log in The source of this code snippet is here. This is especially helpful when experimenting with HTTP POST requests.

<?php
ob_start();
var_dump($this);
error_log(ob_get_clean());

Updated 30 April 2019