title: Preg_Replace() Array with Symbols
body: <p>I am extracting data from lengthy XML documents using <code>foreach</code> loops and <code>if statements</code>. After successfully extracting the data I am formatting it, primarily using <code>preg_replace</code> as a lot of the data is stored as an abbreviation while I need the full word or phrase. I have been successful in creating a <code>preg_replace</code> array which includes all my desired replacements. However, I am struggling with abbreviations such as <code>w/</code>. I want <code>w/</code> to be replaced with <code>with</code> and <code>w/OD</code> with <code>with overdrive</code>. Below is my code and output. </p>
  
  <p><strong><em>My php:</em></strong></p>
  
  <pre><code>&lt;?php
  
  $patterns = [
   '/\b(pwr|pwer)\b/i' =&gt; 'Power',
   '/CVT/' =&gt; 'Automatic',
   '/@/' =&gt; 'at',
  
  ];
  
  echo "&lt;i&gt;All Tech Specs:&lt;/i&gt;.&lt;br&gt;&lt;br&gt;";
  
   foreach ($finaltitle as $titlenumber =&gt; $titlename){
     foreach ($techData as $tsnumber =&gt; $tsname){
       if ($tsnumber == $titlenumber){
         if(empty($tsname) or $tsname === '- TBD -' or $tsname ==='N/A') continue;
           $tsname =  preg_replace(array_keys($patterns), $patterns, $tsname);
             $finaltsdata = "&lt;b&gt;".$titlename." (".$tsnumber.") "."&lt;/b&gt;: ".$tsname."&lt;br&gt;";
  
      echo $finaltsdata;
     }
    }
   }
  
  ?&gt;
  </code></pre>
  
  <p><strong><em>Output:</em></strong></p>
  
  <pre><code>Vehicle Name (1) : Toyota Corolla
  Body Style (2) : Sedan
  Drivetrain (6) : Front Wheel Drive
  EPA Classification (7) : Compact Cars
  Passenger Capacity (8) : 5
  Passenger Volume (9) : 97.5
  Base Curb Weight (10) : 2840
  Engine Type (41) : Regular Unleaded I-4
  Displacement (42) : 1.8 L/110
  Fuel System (43) : Sequential MPI
  SAE Net Horsepower @ RPM (48) : 132 at 6000
  SAE Net Torque @ RPM (49) : 128 at 4400
  Trans Type (52) : 1
  Trans Description Cont. (53) : Automatic w/OD
  </code></pre>
  
  <p>If I add <code>'/w//' =&gt; 'with',</code> to my <code>$patterns</code> array, I get an error due to the inclusion of <code>/</code>. Any ideas on how I can resolve this would be greatly appreciated!</p>