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

  1. <?PHP
  2.     require_once 'Stream/Var.php';
  3.     stream_wrapper_register( "var", "Stream_Var" );
  4.     
  5.     $myVar = array(
  6.                     "foo" => "bar",
  7.                     "argh" => "I really like tomatoes."
  8.                    );
  9.     
  10.     echo    "myVar:";
  11.     echo    "<pre>";
  12.     print_r( $myVar );
  13.     echo    "</pre>";
  14.  
  15.     echo    "<strong>open 'var://GLOBALS/myVar/argh'</strong><br>";
  16.     if ($fp = fopen('var://GLOBALS/myVar/argh','r+')) {
  17.         echo    "success!<br>";
  18.  
  19.         $data = fread($fp, 9);
  20.         echo    "reading 9 chars from stream: $data<br>";
  21.     
  22.         echo "write 'hate' to stream.<br>";
  23.         fwrite($fp,"hate");
  24.         
  25.         fclose($fp);
  26.     }
  27.     echo    "<br>";
  28.     echo    "myVar after fwrite:";
  29.     echo    "<pre>";
  30.     print_r( $myVar );
  31.     echo    "</pre>";
  32. ?>