PHP Classes

File: index.php

Recommend this page to a friend!
  Packages of Maxim   Debug system   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Using sample
Class: Debug system
Output debug information to an HTML log
Author: By
Last change:
Date: 18 years ago
Size: 995 bytes
 

 

Contents

Class file image Download
<?php
    date_default_timezone_set('Europe/Kiev');
    
    function Foo() {
        global $Debug;
        $Debug->AddMessage(__FILE__.': '.__CLASS__.' -> '.__FUNCTION__);
    }
    
    class Some {
        function MyFunc() {
            global $Debug;
            $Debug->AddMessage(__FILE__.': '.__CLASS__.' -> '.__FUNCTION__);
        }
    }
    
    include_once('debug.class.php');
    
    /*
    Class initialisation:
    first param - folder for saving reports (must be writable)
    second param - save error into file on any error
    */
    $Debug = new Debug('log', true);
    $var = 25;
    $Debug->AddMessage('$var', $var); // add to report user message (name and value of variable);
    
    Foo(); // execute function, that add message to report
    
    $x = 5 / 0; // make nonfatal error
    
    $Some = new Some();    
    $Some->MyFunc(); // execute function of class, that add message to report
    
    $Debug->End(true); // Debug end (always in the end of script). If true - report saving into file always, if false - report saving into file only in error
?>