php-pendejo Posted November 12, 2008 Share Posted November 12, 2008 Ok im using this code to debug and get all the globals that are posted on my site $ArrayList = array("_POST", "_GET", "_COOKIE", "_ENV", "_FILES", "_SESSION", "_SERVER"); foreach($ArrayList as $gblArray) { $keys = array_keys($$gblArray); $DebugInfo .= "\n Key: $gblArray - \n"; foreach($keys as $key){ @$$key = trim(${$gblArray}[$key]); if (is_array($$key)){ for($i=0; sizeof($$key); $i++){ $DebugInfo .= "$key = ". @$$key[$i] . " \n"; } } else { $DebugInfo .= "$key = ". @$$key . " \n"; } } } heres the delema. what i need is if $$key is an array to spit it out instead of saying its an array can anyone help? the way I am posting is <select name="block[]" multiple> <option value = 1> test1</option> <option value = 2> test2</option> <select> or something like that Quote Link to comment Share on other sites More sharing options...
.josh Posted November 12, 2008 Share Posted November 12, 2008 If you're just wanting a dump of info for debug purposes, just do something like <?php $ArrayList = array("_POST", "_GET", "_COOKIE", "_ENV", "_FILES", "_SESSION", "_SERVER"); foreach($ArrayList as $gblArray) { echo "$gblArray<br/>"; echo "<pre>"; print_r($$gblArray); echo "</pre>"; } ?> Quote Link to comment Share on other sites More sharing options...
.josh Posted November 12, 2008 Share Posted November 12, 2008 Or hey, just do this: <?php echo "<pre>"; print_r(get_defined_vars()); echo "</pre>"; ?> Quote Link to comment Share on other sites More sharing options...
php-pendejo Posted November 12, 2008 Author Share Posted November 12, 2008 uhm did you read or see the code? 1. I want it in a string called $DebugInfo 2. when i do print_f($$key) it spits out array any other ideas??? Quote Link to comment Share on other sites More sharing options...
.josh Posted November 12, 2008 Share Posted November 12, 2008 okay well first off, you say in the OP you're trying to spit out info, not put it into an array. You just explained how you were having issues trying to spit out info from an array. To me, that means you're trying to spit out info, not put info into an array. 2nd, it's print_r, not print_f. Quote Link to comment Share on other sites More sharing options...
php-pendejo Posted November 12, 2008 Author Share Posted November 12, 2008 ok i want to apologize for saying what i said. I figued out... sorry I didn't see your second post when i replied. once i saw that i did this $Debug_Info = htmlspecialchars(print_r(get_defined_vars(), true)); it made life easier so thank you very much lol 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.