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

  1. <?php
  2.  
  3. // Test script of Cache_Lite_Function
  4. // $Id: test3.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.     'cacheDir' => '/tmp/',
  10.     'lifeTime' => 10
  11. );
  12.  
  13. $cache = new Cache_Lite_Function($options);
  14.  
  15. $data = $cache->call('function_to_bench', 23, 66);
  16. echo($data);
  17.  
  18. $object = new bench();
  19. $object->test = 666;
  20. $data = $cache->call('object->method_to_bench', 23, 66);
  21. echo($data);
  22.  
  23. $data = $cache->call('bench::static_method_to_bench', 23, 66);
  24. echo($data);
  25.  
  26. function function_to_bench($arg1, $arg2) 
  27. {
  28.     echo "This is the output of the function function_to_bench($arg1, $arg2) !<br>";
  29.     return "This is the result of the function function_to_bench($arg1, $arg2) !<br>";
  30. }
  31.  
  32. class bench
  33. {
  34.     var $test;
  35.  
  36.     function method_to_bench($arg1, $arg2)
  37.     {
  38.         echo "\$obj->test = $this->test and this is the output of the method \$obj->method_to_bench($arg1, $arg2) !<br>";
  39.         return "\$obj->test = $this->test and this is the result of the method \$obj->method_to_bench($arg1, $arg2) !<br>";        
  40.     }
  41.     
  42.     function static_method_to_bench($arg1, $arg2) {
  43.         echo "This is the output of the function static_method_to_bench($arg1, $arg2) !<br>";
  44.         return "This is the result of the function static_method_to_bench($arg1, $arg2) !<br>";
  45.     }
  46.  
  47. }
  48.  
  49. ?>