file_put_contents and php4

Discussion in 'PHP' started by Joseph S, Feb 5, 2009.

  1. #1
    I have a script that works on php5 but not on my php4 servers, I need some help to recode this part. I have found some tutorials online but just can`t make them work...

    Here is what I have:

    file_put_contents('1count', 0);
    Code (markup):
    How can I code this to work on php4?

    [edit] I have managed to make it work on php 4, here is the code that I added before the old code:

    function file_put_contents($filename, $data)
    {
      if( $file = fopen($filename, 'w') )
      {
        $bytes = fwrite($file, is_array($data) ? implode('', $data) : $data);
        fclose($file); return $bytes; // return the number of bytes written to the file
      }
    }
    Code (markup):
     
    Joseph S, Feb 5, 2009 IP
  2. lowridertj

    lowridertj Well-Known Member

    Messages:
    2,882
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    195
    #2
    http://www.phpbuilder.com/board/showthread.php?t=10292234
     
    lowridertj, Feb 5, 2009 IP