variable probe revision

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

 



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>';
?> 



-- 
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