home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / bench3.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  1.6 KB  |  59 lines

  1. <?php
  2.  
  3. // Bench script of Cache_Lite_Function
  4. // $Id: bench3.php,v 1.3 2002/09/28 18:05:29 fab Exp $
  5.  
  6. require_once('Cache/Lite/Function.php');
  7.  
  8. $options = array(
  9.     'caching' => true,
  10.     'cacheDir' => '/tmp/',
  11.     'lifeTime' => 10
  12. );
  13.  
  14. $cache = new Cache_Lite_Function($options);
  15.  
  16. $data = $cache->call('function_to_bench', 23, 66);
  17. echo($data);
  18.  
  19. $object = new bench();
  20. $object->test = 666;
  21. $data = $cache->call('object->method_to_bench', 23, 66);
  22. echo($data);
  23.  
  24. $data = $cache->call('bench::static_method_to_bench', 23, 66);
  25. echo($data);
  26.  
  27. function function_to_bench($arg1, $arg2) 
  28. {
  29.     for($i=0;$i<10000;$i++) {
  30.         $tmp = md5(md5(md5('Loosing time...')));
  31.     }
  32.     echo "This is the output of the function function_to_bench($arg1, $arg2) !<br>";
  33.     return "This is the result of the function function_to_bench($arg1, $arg2) !<br>";
  34. }
  35.  
  36. class bench
  37. {
  38.     var $test;
  39.  
  40.     function method_to_bench($arg1, $arg2)
  41.     {
  42.         for($i=0;$i<10000;$i++) {
  43.             $tmp = md5(md5(md5('Loosing time...')));
  44.         }
  45.         echo "\$obj->test = $this->test and this is the output of the method \$obj->method_to_bench($arg1, $arg2) !<br>";
  46.         return "\$obj->test = $this->test and this is the result of the method \$obj->method_to_bench($arg1, $arg2) !<br>";        
  47.     }
  48.     
  49.     function static_method_to_bench($arg1, $arg2) {
  50.         for($i=0;$i<10000;$i++) {
  51.             $tmp = md5(md5(md5('Loosing time...')));
  52.         }
  53.         echo "This is the output of the function static_method_to_bench($arg1, $arg2) !<br>";
  54.         return "This is the result of the function static_method_to_bench($arg1, $arg2) !<br>";
  55.     }
  56.  
  57. }
  58.  
  59. ?>