PHP: Dumping Variable to Error Log

It would be great to error_log(var_dump($arraySomething)); but, alas, it doesn’t work like that. I don’t want to bother making a function that does work (ob_start and ob_end_clean should do it) … so I use print_r instead:

error_log(print_r($arraySomething, true));

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.