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); 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); 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); 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 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. 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 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
Archived
This topic is now archived and is closed to further replies.