Web Analytics Made Easy -
StatCounter Using two functions on one echo? - CodingForum

Announcement

Collapse
No announcement yet.

Using two functions on one echo?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using two functions on one echo?

    I have two functions, one turns un-href links into working href links.


    PHP Code:
    <?php
    $reg_exUrl 
    "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
    ?>

    The other replaces an array of words into a different word.


    PHP Code:
    <?php
    $replace 
    = array(
    'Cat' => 'Dog',
    );
    ?>

    This is how you echo both separately, the problem I'm having and need help with is combining both functions into one echo so both fixes apply to a single variable ($content).


    PHP Code:
    <?php echo str_replace_assoc($replace,$content); ?>

    <?php echo preg_replace(a$reg_exUrl'<a href="'.$url[0].'" target="_blank" class="outboundlink" rel="nofollow">'.$url[0].'</a>'$content); ?>

  • #2
    Did you try this .. I'm just guessing here ...

    <?php echo preg_replace(a$reg_exUrl, '<a href="'.$url[0].'" rel="nofollow" target="_blank" class="outboundlink" rel="nofollow">'.$url[0].'</a>', str_replace_assoc($replace,$content)); ?>


    .

    Comment

    Working...
    X