title: PHP editing Microsoft Word document str_replace and preg_replace don't work
body: <p>Assume, I've got MSWord file source.doc with next content "Content of Microsoft Word file".
  For example, I'd like to open it via PHP and replace word "Microsoft" to "Openoffice" and save the result into <em>result.doc</em>.
  Here is the code using <code>preg_replace</code>:</p>
  
  <pre><code>$content = file_get_contents( SOMEPATH . '/source.doc' );
  $new_content = preg_replace( '/Microsoft/i', 'Openoffice', $content );
  file_put_contents( SOMEPATH . '/target.doc', $new_content );
  </code></pre>
  
  <p>Or using <code>str_replace</code>:</p>
  
  <pre><code>$content = file_get_contents( SOMEPATH . '/source.doc' );
  $new_content = str_replace( 'Microsoft', 'Openoffice', $content );
  file_put_contents( SOMEPATH . '/target.doc', $new_content );
  </code></pre>
  
  <p>None of them doesn't work. Code runs without any exceptions, but <em>target.doc</em> is the same as <em>source.doc</em>. Replacement not performs.</p>
  
  <p>I've tried a lot of different reciepts, such as regular expression modificators, iconv and so on, but nothing helps.</p>
  
  <p><code>var_dump</code> of <code>$content</code> shows raw structure of <em>source.doc</em> that is full of unusual characters and as I suppose some of it stops <code>str_replace</code> or <code>preg_replace</code> scanning. Can't figure out which char is it and what should I do if I'll find it.</p>
  
  <p><code>var_dump</code> of <code>$new_content</code> is identical to $content.</p>
  
  <p>Thanks forward for any help!</p>