sfxworks Posted August 16, 2011 Share Posted August 16, 2011 How do I turn print_r into a variable string that I can put in an array for an http_build_query method? I tried print_r($nbt->root,true); but that did nothing. I am working with php version 5.1.2. Link to comment https://forums.phpfreaks.com/topic/244910-turning-print_r-into-a-string/ Share on other sites More sharing options...
trq Posted August 16, 2011 Share Posted August 16, 2011 print_r is used for debugging. You'll need to be a little more descriptive with what it is exactly you want to do. Link to comment https://forums.phpfreaks.com/topic/244910-turning-print_r-into-a-string/#findComment-1258059 Share on other sites More sharing options...
phpSensei Posted August 16, 2011 Share Posted August 16, 2011 print_r doesn't push values into an array OP, nor does it create it. Look into PHP array functions. Link to comment https://forums.phpfreaks.com/topic/244910-turning-print_r-into-a-string/#findComment-1258088 Share on other sites More sharing options...
PFMaBiSmAd Posted August 16, 2011 Share Posted August 16, 2011 http_build_query expects either an associative array, a numerically indexed array, or an object containing properties. What does $nbt->root contain? Link to comment https://forums.phpfreaks.com/topic/244910-turning-print_r-into-a-string/#findComment-1258143 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.