title: Preg_Replace_Callback replacing matched items with Array
body: <p>I created a replace function to identify twitter accounts and I want to create a link to my internal pages if I have that twitter account present in my data.</p>
  
  <pre><code>//Creates a link for users
      $tester = preg_replace_callback(
      '/\s+@(\w+)/',
        "BrewIdFinder",
      $tester );
  
  
  function BrewIdFinder($matches){
  $result3 = mysql_query("SELECT brew_id FROM places WHERE screen_name = '".$matches."' LIMIT 1");
          $num_rows = mysql_num_rows($result3);
          if($num_rows==0){
          $x= '&lt;a href="http://twitter.com/'.$matches.'" target="_new"&gt;@'.$matches.'&lt;/a&gt;';
          }else{
          while($row = mysql_fetch_array($result3))
         {
          $brewid= $row['brew_id'];
         }
          $x= '&lt;a href="http://www.brewzinga.com/places/'.$brewid.'" target="_new"&gt;@'.$matches.'&lt;/a&gt;';
           }
  return $x;
  }
  </code></pre>
  
  <p>I get a return for each Twitter Screenname as Array.  Can I get some help figuring out what is wrong?</p>