JustinK101 Posted April 8, 2009 Share Posted April 8, 2009 I know print_r prints the contents of an object, exactly what I want, but print_r forces the output to screen. Is there a way to just store the string output of print_r so I can email it? Thanks. Does this work? $string = print_r($my_obj); Quote Link to comment https://forums.phpfreaks.com/topic/153089-print_r-to-not-output-to-screen/ Share on other sites More sharing options...
Maq Posted April 8, 2009 Share Posted April 8, 2009 $string = print_r($my_obj, return=TRUE); Quote Link to comment https://forums.phpfreaks.com/topic/153089-print_r-to-not-output-to-screen/#findComment-804129 Share on other sites More sharing options...
JustinK101 Posted April 8, 2009 Author Share Posted April 8, 2009 Maq, Thanks, it was simple: $string = print_r($my_object, TRUE); Quote Link to comment https://forums.phpfreaks.com/topic/153089-print_r-to-not-output-to-screen/#findComment-804136 Share on other sites More sharing options...
Maq Posted April 8, 2009 Share Posted April 8, 2009 Maq, Thanks, it was simple: $string = print_r($my_object, TRUE); Whoops, yeah, you don't need the return= in there. :-X Quote Link to comment https://forums.phpfreaks.com/topic/153089-print_r-to-not-output-to-screen/#findComment-804137 Share on other sites More sharing options...
.josh Posted April 8, 2009 Share Posted April 8, 2009 They should put something like that in the manual. Seems like something that would be helpful to know. Quote Link to comment https://forums.phpfreaks.com/topic/153089-print_r-to-not-output-to-screen/#findComment-804165 Share on other sites More sharing options...
Maq Posted April 8, 2009 Share Posted April 8, 2009 They should put something like that in the manual. Seems like something that would be helpful to know. lol Quote Link to comment https://forums.phpfreaks.com/topic/153089-print_r-to-not-output-to-screen/#findComment-804174 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.