<?php

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
  }
}

?>