Re: variable probe revision

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Ashley Sheridan" <ash@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:1231796437.3558.62.camel@xxxxxxxxxxxxxxxxxxxxxxxx
> On Mon, 2009-01-12 at 16:11 -0500, Frank Stanovcak wrote:
>> I posted this once before, and then tried to use it multiple times in a
>> script.  As you can guess I got a bunch of func already defined errors.
>>
>> Here is a revision incase anyone decided to use it that will work
>> multiple
>> times in the same script for variable watching.
>>
>> -------Code follows-------
>> <?php
>> if(!function_exists(breakarray)){
>>  function breakarray($passed){
>>   echo '<table border="1"><tr><th>key</th><th>value</th></tr>';
>>   foreach($passed as $tkey=>$tvalue){
>>    echo '<tr><td>[' , $tkey , ']</td><td>';
>>    if(is_array($tvalue)){
>>     if(sizeof($tvalue) > 0){
>>      breakarray($tvalue);
>>      echo '</td></tr>';
>>     }else{
>>      echo '"' , $tvalue , '"</td></tr>';
>>     };
>>    }else{
>>     echo 'EMPTY </td></tr>';
>>    };
>>   };
>>   echo '</table>';
>>  };
>> };
>>
>> echo '<table border=1><tr> <th>variable</th> <th>value</th> </tr>';
>> foreach(get_defined_vars() as $key => $value){
>>  echo '<tr><td>$',$key ,'</td><td>';
>>     if(is_array($value) and $key != 'GLOBALS'){
>>   if(sizeof($value) > 0){
>>    breakarray($value);
>>    echo '</td></tr>';
>>   }else{
>>    echo 'EMPTY </td></tr>';
>>   };
>>  }else{
>>   echo '"' , $value , '"</td></tr>';
>>  };
>> };
>> echo '</table>';
>> ?>
>>
>>
>>
> Why not put the function in a functions include and use a require_once()
> on it?
>
>
> Ash
> www.ashleysheridan.co.uk
>

You could do that, but I prefer to just keep one file in my root, and call
it when I need it.  It's not meant to stay there as it's only for bug
hunting purposes.

It's a preference thing I guess.

Frank.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux