title: change \ to \\ for path php
body: <p>I have a string which is a path and is a variable in which I have to save in my database. But the path is </p>
  
  <pre><code>C:\foldera\folderb\folder1\folder2
  </code></pre>
  
  <p>and obviously I need it to be </p>
  
  <pre><code>C:\\foldera\\folderb\\folder1\\folder2
  </code></pre>
  
  <p>for the insertion in database of mysql.</p>
  
  <p>Please help me find the solution. I tried <code>str_replace</code> but it won't work.
  Thanks in advance.</p>