title: very simple preg_replace not working
body: <pre><code>function emotify($text)
  {
      $icons = array(
                  ':)'    =&gt;  '&lt;img src="/images/emoticons/happy.png" alt="smile" class="icon_smile" /&gt;',
                  ':-)'   =&gt;  '&lt;img src="/images/emoticons/happy.png" alt="smile" class="icon_smile" /&gt;',
                  ':D'    =&gt;  '&lt;img src="/images/emoticons/grin.png" alt="smile" class="icon_laugh" /&gt;',
                  ':d'    =&gt;  '&lt;img src="/images/emoticons/grin.png" alt="laugh" class="icon_laugh" /&gt;',
                  ":'("    =&gt;  '&lt;img src="/images/emoticons/crying.png" alt="crying" class="icon_cry" /&gt;',
                  ';('    =&gt;  '&lt;img src="/images/emoticons/crying.png" alt="crying" class="icon_cry" /&gt;',
                  ':d'    =&gt;  '&lt;img src="/images/emoticons/grin.png" alt="laugh" class="icon_laugh" /&gt;',
                  ';)'    =&gt;  '&lt;img src="/images/emoticons/wink.png" alt="wink" class="icon_wink" /&gt;',
                  ':P'    =&gt;  '&lt;img src="/images/emoticons/tounge.png" alt="tounge" class="icon_tounge" /&gt;',
                  ':-P'   =&gt;  '&lt;img src="/images/emoticons/tounge.png" alt="tounge" class="icon_tounge" /&gt;',
                  ':-p'   =&gt;  '&lt;img src="/images/emoticons/tounge.png" alt="tounge" class="icon_tounge" /&gt;',
                  ':p'    =&gt;  '&lt;img src="/images/emoticons/tounge.png" alt="tounge" class="icon_tounge" /&gt;',
                  ':('    =&gt;  '&lt;img src="/images/emoticons/sad.png" alt="sad face" class="icon_sad" /&gt;',
                  ':-('   =&gt;  '&lt;img src="/images/emoticons/sad.png" alt="sad face" class="icon_sad" /&gt;',
                  ':o'    =&gt;  '&lt;img src="/images/emoticons/shocked.png" alt="shock" class="icon_shock" /&gt;',
                  ':O'    =&gt;  '&lt;img src="/images/emoticons/shocked.png" alt="shock" class="icon_shock" /&gt;',
                  ':0'    =&gt;  '&lt;img src="/images/emoticons/shocked.png" alt="shock" class="icon_shack" /&gt;',
                  ':|'    =&gt;  '&lt;img src="/images/emoticons/straight.png" alt="straight face" class="icon_straight" /&gt;',
                  ':-|'   =&gt;  '&lt;img src="/images/emoticons/straight.png" alt="straight face" class="icon_straight" /&gt;',
                  ':/'    =&gt;  '&lt;img src="/images/emoticons/straight.png" alt="straight face" class="icon_straight" /&gt;',
                  ':-/'   =&gt;  '&lt;img src="/images/emoticons/straight.png" alt="straight face" class="icon_straight" /&gt;'
          );
  
       foreach($icons as $icon=&gt;$image) {
        $icon = preg_quote($icon, '/');
  $return = preg_replace("/$icon/i", $image, $text);
        }
      return $return;
  }
  $posted = emotify($posted);
  </code></pre>
  
  <p>this is my code to change emoticons into images. it just returns<br>
  <code>Warning: preg_replace(): Unknown modifier '/' on line 203</code></p>
  
  <p>how can I fix it?
  EDIT: this is all of my code including the array which may be the problem why my code is not working. I'm not sure, but non of the answers have helped so I think that must be were the problem lies.</p>