Last active
January 3, 2023 14:53
-
-
Save mkolb/2379498 to your computer and use it in GitHub Desktop.
var_dump into error log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ob_start(); | |
var_dump($this); | |
error_log(ob_get_clean()); | |
?> |
ob_get_contents()
and ob_end_clean()
can be merge in one call to ob_get_clean()
Based on nsitbon's answer, and further optimization... we can write:
ob_start();
var_dump($this);
error_log(ob_get_clean());
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
+1
Thanks for sharing with this simple, small but awesome snippet