Posted By

neogeek on 07/01/06


Tagged

file


Versions (?)

File Put Contents


 / Published in: PHP
 

Similar to the fileputcontents() function in PHP5 built for PHP4 (will not cause errors on a server running PHP5).

  1. if (!function_exists('file_put_contents')) {
  2.  
  3. function file_put_contents($file, $contents = '', $method = 'a+') {
  4.  
  5. $file_handle = fopen($file, $method);
  6.  
  7. fwrite($file_handle, $contents);
  8.  
  9. fclose($file_handle);
  10.  
  11. return true;
  12.  
  13. }
  14.  
  15. }

Report this snippet  

You need to login to post a comment.