drewjoh Posted April 3, 2006 Share Posted April 3, 2006 I'm trying to get the same effect you get say you have an array, and you can output the contents to the screen in a nice formatted way. ie: print_r($array);gives you:[code]array => Array element1 => value1 element2 => value2[/code]What I need though, is to have this formatted output given to a variable... what I'm trying to do is mail the results to myself.Doing something like mail($to, $subject, print_r($array)); doesn't work, it just gives me a number.Any ideas? :) Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 3, 2006 Share Posted April 3, 2006 If you look at the [a href=\"http://www.php.net/print_r\" target=\"_blank\"]manual page[/a] for the print_r() function, you will see that it takes a second parameter. When that parameter, the output can be assigned to a variable.Example:[code]<?phpecho '<pre>' . print_r($_SERVER,true) . '</pre>';//// or//$body = print_r($_SERVER,true);?>[/code]Ken Quote Link to comment Share on other sites More sharing options...
drewjoh Posted April 3, 2006 Author Share Posted April 3, 2006 OHHH, awesome. Thanks Ken.I had read that but didn't comprehend what exactly the bool return meant.Thank you, thank you :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.