<?php
function replaceAccountExists($accounts_request, $texto) {
    preg_match_all('/(^|\s)(@\w+)/', $texto, $result);
    $data = $result[2];
    $data = array_map(function($value) use ($accounts_request) { 
    $account = strtolower(str_replace('@', '', $value));	
    $exists = (in_array($account, $accounts_request));
        return array(
                 'parameter_send' => $value,
                 'exists_account'=> $exists,
                 'url' => '<a href="http://w...content-available-to-author-only...e.com/' 
                          . $account . '">'
                          . $value . '</a>'
        ); 
    }, $data);

    if (!empty($data)) {
       foreach($data as $val) {
           if ($val['exists_account']) {
              $texto = str_replace($val['parameter_send'],$val['url'], $texto);
           }
       }
    }
    return $texto;

   }

   //requisições válidas do banco
   $accounts_request = array(
    'existo',
    'existia',
    'hash2tag',
    '234'
   );

    $texto = '@Felipe @luizao @Patronaltacao abobrinha @ 234 @existo @hash2tag @ textoxyz @NomeAqui @existia';
    $texto_novo = replaceAccountExists($accounts_request, $texto); 
    echo $texto_novo;