PHP how to update variable in php-file
<p>How do i update a variable in a php file and save it to disk? I'm trying to make a small CMS, in one file, no database, and i'd like to be able to update the config variables, I've made a settings page and when i update i'd like the variables to updated in the php-file. 
Below will update the variable, but of course not save it to the php-file, so how do i do that?</p>

<pre><code>&lt;?php 
$USER = "user";
if (isset($_POST["s"]) ) { $USER = $_POST['USER']; }
?&gt;
&lt;html&gt;&lt;body&gt; 
Current User: &lt;?php echo $USER; ?&gt;
&lt;form method="post" action="&lt;?php echo $_SERVER["SCRIPT_NAME"]; ?&gt;"&gt;
New User&lt;input type="text" name="USER" value="&lt;?php echo $USER; ?&gt;"/&gt;
&lt;input type="submit" class="button" name="s" value="Update" /&gt;
&lt;/form&gt;
&lt;/body&gt;&lt;/html&gt;
</code></pre>

<p>I don't know if i'm missing the obvious?
I was thinking of using something like this:</p>

<pre><code>$newcms = file_get_contents(index.php)
str_replace(old_value, new_value, $newcms)
file_puts_contents(index.php, $newcms)
</code></pre>

<p>But it doesn't seem like the right solution...</p>
