title: preg_replace_callback(): Requires argument 2 to be a valid callback
body: <p>I'm learning PHP with some pre-made websites so I can see how it's done because I'm a visual learner, but I've run into a problem.</p>
  
  <p>I got an error saying</p>
  
  <blockquote>
    <p>preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead</p>
  </blockquote>
  
  <p>Now I know this happens because of a newer PHP that doesn't support <code>preg_replace()</code> but <code>preg_replace_callback()</code>, but upon changing it, I get this error:</p>
  
  <blockquote>
    <p>preg_replace_callback(): Requires argument 2, 'preg_replace('/(.{59})/', '\$1&lt; >', '$1')', to be a valid callback</p>
  </blockquote>
  
  <p>The code makes too long messages in a chatbox divided into two separate ones to keep all letters inside the chat window.</p>
  
  <p>The error was located in line 20, where only the <code>$msg);</code> stands.</p>
  
  <pre><code>if ($shoutbox['fixLongWords'] &gt; 5 &amp;&amp; $shoutbox['fixLongWords'] &lt; $shoutbox['maxMsgLenght'])
  {
      $non_breaking_space = $context['utf8'] ? ($context['server']['complex_preg_chars'] ? '\x{A0}' : "\xC2\xA0") : '\xA0';
  
      if ($context['browser']['is_gecko'] || $context['browser']['is_konqueror'])
          $breaker = '&lt;span style="margin:0 -0.5ex 0 0"&gt; &lt;/span&gt;';
      elseif ($context['browser']['is_opera'])
          $breaker = '&lt;span style="margin:0 -0.65ex 0 -1px"&gt; &lt;/span&gt;';
      else
          $breaker = '&lt;span style="width:0;margin:0 -0.6ex 0 -1px"&gt; &lt;/span&gt;';
  
      $shoutbox['fixLongWords'] = (int) min(1024, $shoutbox['fixLongWords']);
  
      if (strlen($msg) &gt; $shoutbox['fixLongWords'])
      {
          $msg = strtr($msg, array($breaker =&gt; '&lt; &gt;', '&amp;nbsp;' =&gt; $context['utf8'] ? "\xC2\xA0" : "\xA0"));
          $msg = preg_replace(
              '~(?&lt;=[&gt;;:!? ' . $non_breaking_space . '\]()]|^)([\w\.]{' . $shoutbox['fixLongWords'] . ',})~e' . ($context['utf8'] ? 'u' : ''),
              'preg_replace(\'/(.{' . ($shoutbox['fixLongWords'] - 1) . '})/' . ($context['utf8'] ? 'u' : '') . '\', \'\\$1&lt; &gt;\', \'$1\')',
              $msg);
          $msg = strtr($msg, array('&lt; &gt;' =&gt; $breaker, $context['utf8'] ? "\xC2\xA0" : "\xA0" =&gt; '&amp;nbsp;'));
      }
  }
  </code></pre>
  
  <p>Anyone have any idea what might be causing the problem?</p>