Source for file writeTest.php

Documentation is available at writeTest.php

  1. <?
  2. //writeTest.php
  3. //place this file in an RWX folder, to see if it's writeable
  4. $fileName "data.txt";  //this is the file used to read/write
  5.  
  6. //w+ is write and/or create
  7. //a+ is append and/or create
  8. //r is read
  9. //r+ is read/write
  10. $myMode "a+";
  11.  
  12. $isOpen fopen($fileName,$myMode);//try to open file
  13. if($isOpen)
  14. {
  15.     //write to file!!
  16.     fwrite($isOpen,"Here is my text!");
  17.     fclose($isOpen);
  18.     //print "Yahoo it worked!";
  19.     
  20.     fileRead($fileName);//this is my new function
  21.  
  22.     
  23.     
  24.     die();    
  25. }else{
  26.     //tell them bad stuff happened...
  27.     print "It didn't work!";
  28.     die();
  29. }
  30.  
  31. function fileRead($fileName)
  32. {
  33.     //do magic stuff here.. like read a file!!
  34.     $myArray file($fileName);
  35.     for($x=0;$x<count($myArray);$x++)
  36.     {
  37.         //do magic stuff here, like read the line!!
  38.         //or better yet print the line???
  39.         print $myArray[$x'<br />';    
  40.     }
  41.     
  42. }
  43.  
  44.  
  45.  
  46.  
  47.  
  48. ?>

Documentation generated on Sat, 03 May 2008 19:47:45 -0700 by phpDocumentor 1.4.1