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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php