I'm developing a logging system and need to get the data generated by print_r () , to send in the email in case of an error in the API, this way the developers will be warned, already containing all the data, including the array.
Thank you!
I'm developing a logging system and need to get the data generated by print_r () , to send in the email in case of an error in the API, this way the developers will be warned, already containing all the data, including the array.
Thank you!
To get the output / structure of some variable with the print_r()
, enter the second argument as true
, so the function returns the structure of the passed variable instead of printing on the screen.
<?php
$arr = range(1,5);
$log = print_r($arr, true);