PHP Classes

File: example.php

Recommend this page to a friend!
  Packages of Zubov Ilya   Solace profiler   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script with profiling
Class: Solace profiler
Profiler to analyse the time spent by a script
Author: By
Last change:
Date: 22 years ago
Size: 1,008 bytes
 

 

Contents

Class file image Download
<?php
     include_once('class.solace.profiler.php');
     declare(ticks=1);
include('example_include.php');

// This example does nothing, just a demonstration

    $a = 1; // direct assignment is the fastest operation
    $b = 20;
    for ($i = 0; $i < 100; $i++) { // 'for' is counted at the ending '}'
        $a = $a; // dummy, just to compare speed
        $aa = &$a; // assigning and referencing takes the same time
        $a++;
        $b += 1; // this is usually a bit slower then $a++ (at least on my slow test PC)
        $c = test($a, $b); // the main time-eater
        if ($c) {  // 'if' is counted at the ending '}'
            $f = @fopen(__FILE__, 'r');
            if ($f) fclose($f); // closing is faster then opening
            $b++;
        }
        else // 'else' is counted at the ending '}'
        {
            $a++;
        } // this line shows 160 (summary of 'else' and overall 'if' passes)
    } // 101 = 100 cycles + 1 initial php parser pass

?>