Log an Array |
[eluser]tchule[/eluser]
Hello, I'm constantly in need for a way to debug and log some Arrays. I'd like to log it in the log file instead of having to use a var_dump. I've added the following function to the Commun.php file of code_igniter, it works but it's probably ugly. If someone knows of a better way i'm interested ... Code: function log_array($level = 'error', $array, $php_error = FALSE) Tchule
[eluser]Paul Scott[/eluser]
You can use var_export to simply return the structure of the array as a string, instead of using the output buffer, and then you could log that. Similarly with print_r. So you could do something like Code: $my_array = array ( |
Welcome Guest, Not a member yet? Register Sign In |