cannot write value into file via PHP
<p>I have a configuration file like the following,</p>

<pre><code>NameA=3
NameB=2
NameC=1
</code></pre>

<p>The following code tries to find NameC, and replace its value. Suppose here I pass in the value 0.</p>

<pre><code>public function writeScreenSwitch($isTick)
{
    $filename = 'my/file/path';
    $data = parse_ini_file($filename);
    $replace_with = array(
      'NameC' =&gt; $isTick
    ); 
    // After print out $replace_with value, I'm sure the value is,
    //     [NameC] =&gt; 0

    $fh = fopen($filename, 'w');
    foreach ( $data as $key =&gt; $value )
    {
       if ( !empty($replace_with[$key]) ) {
          $value = $replace_with[$key];
       } else {
          echo "array empty";   
          // the problem is here.
          // $replace_with[$key] is always empty.
          // but before the loop, the value $replace_with['NameC']=0
          // why.
       }

       fwrite($fh, "{$key}={$value}" . PHP_EOL);
    }
    fclose($fh);
}
</code></pre>

<p>I have described the problem on the code.</p>
