Login   Register  
PHP Classes
elePHPant
Icontem

File: lib-debug.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Randy Gerritse  >  IMDBSearch  >  lib-debug.php  >  Download  
File: lib-debug.php
Role: Auxiliary script
Content type: text/plain
Description: easy debug functions for displaying values
Class: IMDBSearch
Search the Internet Movie DataBase
Author: By
Last change:
Date: 2003-07-30 10:22
Size: 949 bytes
 

Contents

Class file image Download
<?
/*    functions for debugging a php application
    Don't modify without written authrization
    Email: randy@randy.nu
    © Randy Gerritse 2002, All rights reserved.
    ================================================================================ */

//function to print the structure of an array
function debugArray($arr) {
    if (
is_array($arr)) {
        echo 
"<br><br><pre><font color=red>";
        
print_r($arr);
        echo 
"</font></pre><br><br>";
    } else
        echo 
"<br><br><font color=red>not an array!</font><br><br>";
}

//function to echo the content of a string
function debugString($string) {
    if (!empty(
$string)) {
        echo 
"<br><br><pre><font color=red>";
        echo 
$string;
        echo 
"</font></pre><br><br>";
    } else
        echo 
"<br><br><font color=red>string is empty!</font><br><br>";
}

//debug the db
function debugDB($ident "") {
    if (
$ident == "")
        
$ident $GLOBALS["connection"]->ident;
    
debugString(mysql_error($ident));
}
?>