PHP_Compat
[ class tree: PHP_Compat ] [ index: PHP_Compat ] [ all elements ]

Source for file file_put_contents.php

Documentation is available at file_put_contents.php

  1. <?php
  2. // +----------------------------------------------------------------------+
  3. // | PHP Version 4                                                        |
  4. // +----------------------------------------------------------------------+
  5. // | Copyright (c) 1997-2004 The PHP Group                                |
  6. // +----------------------------------------------------------------------+
  7. // | This source file is subject to version 3 of the PHP license,         |
  8. // | that is bundled with this package in the file LICENSE, and is        |
  9. // | available at through the world-wide-web at                           |
  10. // | http://au.php.net/license/3_0.txt.                                   |
  11. // | If you did not receive a copy of the PHP license and are unable to   |
  12. // | obtain it through the world-wide-web, please send a note to          |
  13. // | license@php.net so we can mail you a copy immediately.               |
  14. // +----------------------------------------------------------------------+
  15. // | Author: Aidan Lister <aidan@php.net>                                 |
  16. // +----------------------------------------------------------------------+
  17. //
  18. // $Id: file_put_contents.php,v 1.6 2004/05/19 12:06:20 aidan Exp $
  19. //
  20.  
  21.  
  22. /**
  23.  * Replace file_put_contents()
  24.  * PHP 5
  25.  *
  26.  * http://php.net/function.file_put_contents
  27.  *
  28.  * @author        Aidan Lister <aidan@php.net>
  29.  * @version       1.0
  30.  */
  31. if (!function_exists('file_put_contents'))
  32. {
  33.     function file_put_contents ($filename$content)
  34.     {
  35.         $bytes = 0;
  36.  
  37.         if (($file fopen($filename'w+')) === false{
  38.             return false;
  39.         }
  40.  
  41.         if (($bytes fwrite($file$content=== false{
  42.             return false;
  43.         }
  44.  
  45.         fclose($file);
  46.  
  47.         return $bytes;
  48.     }
  49. }
  50.  
  51. ?>

Documentation generated on Mon, 11 Mar 2019 10:16:41 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.