title: Preg_replace do not exist in php7. What can i do?
body: <p>I have a form where i get a filename from a inputbox. I create the a directory and change the extension form "gpx" to "xml" of the file before i upload the file to my directory.
  In php5 i need preg_replace, but in php i can't do it anymore. </p>
  
  <p>I have this code:
    My old code is:</p>
  
  <pre><code>  if (!file_exists($dirPath)) {
      mkdir($dirPath, 0755,true);
      }
      $target = '/'.$mappe.'/'; 
      $target = $dirPath .'/'. basename( $_FILES['gpsfilnavn']['name']); 
          $target =    preg_replace("/(\w+).gpx/ie","$1.'.xml'",$target);    
          $xmlfil = $xmlfil . basename( $_FILES['gpsfilnavn']['name']); 
          $xmlfil =    preg_replace("/(\w+).gpx/ie","$1.'.xml'",$xmlfil);     
          if(move_uploaded_file($_FILES['gpsfilnavn']['tmp_name'], $target)) {
          echo "The file ".  basename( $_FILES['gpsfilnavn']['name'])." has been  uploaded";
  </code></pre>
  
  <p>Can anybody help me what i have to change?</p>