title: PHP Replace words in other file
body: <p>i have got a variable with the value of:
  <b>1a2b3c</b>.
  Now I want to find the "1" in the other file ("test.css") and replace it with "a". Then I want to replace the "2" with the "b" and the "3" with the "c" How can I do this? Is it possible? Thank you for your help. And sorry I didnt say that before but I dont want to replace it in the same file. I want to create a new file with these replaced values.</p>
  
  <p>Code:</p>
  
  <pre><code>$arr1 = str_split($name);
  $arr2 = str_split($_GET[$name]);
  </code></pre>
  
  <p>Then I got two arrays:</p>
  
  <p>1:</p>
  
  <pre><code>[0]=1
  [0]=2
  [0]=3
  </code></pre>
  
  <p>2:</p>
  
  <pre><code>[0]=a
  [0]=b
  [0]=c    
  </code></pre>
  
  <p>PS: There are not exactly 3 values every time. Sometimes it looks like: <b>1a2b3c4d5e...</b> I want to do that dynamicly</p>
  
  <p>PPS: Sorry for my bad english...ˆˆ</p>
  
  <p>So heres ALL my code:</p>
  
  <p>index.php</p>
  
  <pre><code>&lt;?php
  include 'parser.php';
  
  print "&lt;form method=\"get\" action=\"test.php\"&gt;";
  $parser = new ConfigParser("test.theme");
  $parser-&gt;parse();
  print "&lt;input type=\"submit\"&gt;&lt;/input&gt;";
  print "&lt;/form&gt;";
  
  ?&gt;
  </code></pre>
  
  <p>parser.php</p>
  
  <pre><code>&lt;?php
  
  class ConfigParser 
  {
  
      private $name = "";
  
      function __construct($filename)
      {
          $this-&gt;name = $filename;
      }
  
      function parse() {
  
          foreach(file($this-&gt;name) as $line) {
              if(strlen($line) &lt; 3){
  
                  echo ("YOU ARE TO DAMM STUPID TO MAKE A CONFIG FILE, IDIOT!");
                  return;
  
           }
              list($name, $type, $label) = explode(":", $line);
  
  
          print "&lt;p&gt;". $label. "&lt;/p&gt;&lt;input type=\"" . $type . "\" name=\"". $name. "\"&gt; &lt;/input&gt;";
          }
          print "&lt;input type=\"text\" name=\"theme\" value=\"" .$this-&gt;name ."\" readonly&gt;&lt;/input&gt;";
      }
  
  }
  
  
  ?&gt;
  </code></pre>
  
  <p>reader.php</p>
  
  <pre><code>&lt;?php
  
  class Writer
  {
  
      private $file = "";
  
      function __construct($theme)
      {
          $this-&gt;file = $theme;
          list($list) = explode('.', $this-&gt;file, 2);
          $style = $list.".css";
  
  
          foreach(file($this-&gt;file) as $line) {
              if(strlen($line) &lt; 3){
  
                  echo ("YOU ARE TO DAMM STUPID TO MAKE A CONFIG FILE, IDIOT!");
                  return;
  
           }
              list($name, $type, $label) = explode(":", $line);
  
              $style_raw = file_get_contents("test.css");
  
              //$mix = $name.$_GET[$name];
              //print $mix;
  
              $arr1 = str_split($name);
              $arr2 = str_split($_GET[$name]);
  
          //  $file = fopen("created/style.css", "w");
              //  fwrite($file, $custom_style);
              //  fclose($file);
      }       
  
  }
  
  }
  ?&gt;
  </code></pre>
  
  <p>test.theme</p>
  
  <pre><code>user:text:Username
  color:color:Color
  test:password:Password
  </code></pre>
  
  <p>test.css</p>
  
  <pre><code>user
  color
  test
  </code></pre>