2
I’m developing a log system and need to get the data generated by print_r(), to send in the email if any error occurs in the API, this way the developers will be warned, already containing all the data, including the array.
Grateful!
2
I’m developing a log system and need to get the data generated by print_r(), to send in the email if any error occurs in the API, this way the developers will be warned, already containing all the data, including the array.
Grateful!
2
To take the output/structure of some variable with the print_r()
inform the second argument as true
, thus the function returns the structure of the variable passed instead of printing on the screen.
<?php
$arr = range(1,5);
$log = print_r($arr, true);
Browser other questions tagged php array
You are not signed in. Login or sign up in order to post.
What’s the matter?
$log = print_r($objeto, true);
this way it is not displayed but stored in$log
.– rray
Thanks anyway, I didn’t even notice you had this parameter. ;)
– Williams