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. Quote 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. Quote 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. Quote 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? Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.