Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var_dump into error log
<?php
ob_start();
var_dump($this);
error_log(ob_get_clean());
?>
@kimek

This comment has been minimized.

Copy link

@kimek kimek commented Jun 15, 2016

+1
Thanks for sharing with this simple, small but awesome snippet

@nsitbon

This comment has been minimized.

Copy link

@nsitbon nsitbon commented Jun 28, 2016

ob_get_contents()and ob_end_clean() can be merge in one call to ob_get_clean()

@mkormendy

This comment has been minimized.

Copy link

@mkormendy mkormendy commented Jul 20, 2016

Based on nsitbon's answer, and further optimization... we can write:

ob_start();
var_dump($this);
error_log(ob_get_clean());
@mkolb

This comment has been minimized.

Copy link
Owner Author

@mkolb mkolb commented Mar 22, 2017

Thanks @nsitbon and @mkormendy! I've updated the gist to simplify it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment