using two replace functions on one echo

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

[php]

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

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

[php]<?php
$replace = array(
‘Cat’ => ‘Dog’,
);
?>
[/php]

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]

<?php echo str_replace_assoc($replace,$content); ?> <?php echo preg_replace(a$reg_exUrl, ''.$url[0].'', $content); ?>

[/php]

Hi there,

I think you’re after this:
[php]<?php
$content = str_replace_assoc($replace,$content);
$content = preg_replace(a$reg_exUrl, ‘’.$url[0].’’, $content);
echo $content;
?>
[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service