php file_put_content overwrite
<p>So i found this code which lets be write to a specific line</p>

<pre><code>  function SetSiteName(){
        global $session, $database, $form;
    $filepathname = "include/classes/constants.php";
    $target = 'sitename';
    $newline = 'define("sitename", "Testing.");';

    $stats = file($filepathname, FILE_IGNORE_NEW_LINES);   
    $offset = array_search($target,$stats) +32;
    array_splice($stats, $offset, 0, $newline);   
    file_put_contents($filepathname, join("\n", $stats)); 
    header("Location: ".$session-&gt;referrer);
   }
</code></pre>

<p>however it will not overwrite whats on that line it'll go to the next line and put the data in.. I'd like to make it overwrite what currently is on that line?</p>

<p>Any thoughts? </p>