Syntax to apply two functions on one string
<p>Why was this closed?  People really think that nobody else will ever need to learn how to apply two functions to one string?  That is what the question was BTW.</p>

<p>*<em>*</em>*This question has been solved 
working code:</p>

<pre><code>link_up(htmlentities($row['note']))
</code></pre>

<p>Thanks for the help, just needed the correct syntax I guess.  Thanks!</p>

<p>Ok so I have a form that visitors can fill out to leave a note.  I created a function called link_up that turns a typed web address in the note into a clickable link without using html tags.  The problem is since I will be displaying user input I would also like to use htmlentities when it is displayed.  This is my code that works without htmlentities.</p>

<p>This works but isn't secure...</p>

<pre><code>&lt;tr&gt;&lt;td class='note'&gt;" . link_up($row['note']) . "&lt;/td&gt;" ;
</code></pre>

<p>this also works but doesn't use the link_up function I created for it</p>

<pre><code>echo "&lt;tr&gt;&lt;td class='note'&gt;" . htmlentities($row['note']) . "&lt;/td&gt;" ;
</code></pre>

<p>so what I need is something like this (but this obviously doesn't work)</p>

<pre><code>echo "&lt;tr&gt;&lt;td class='note'&gt;" . htmlentities . link_up($row['note']) . "&lt;/td&gt;" ;
</code></pre>

<p>So I guess what I am asking is, how can I use both the htmlentities function AND the link_up function I made at the same time so that when $row['note'] is echo'd it both is secure and works as intended?   Or maybe it makes more sense to ask how can I use two functions on one echo string at the same time?</p>

<p>This is the link_up function</p>

<pre><code>function link_up($text)  
{  
$text= preg_replace("/(^|[\n ])([\w]*?)((ht|f)tp(s)?:\/\/[\w]+[^ \,\"\n\r\t&lt;]*)/is", "$1$2&lt;a href=\"$3\" class=\"notelink\" target=\"blank\"&gt;$3&lt;/a&gt;", $text);  
$text= preg_replace("/(^|[\n ])([\w]*?)((www|ftp)\.[^ \,\"\t\n\r&lt;]*)/is", "$1$2&lt;a href=\"http://$3\" class=\"notelink\" target=\"blank\" &gt;$3&lt;/a&gt;", $text);  
$text= preg_replace("/(^|[\n ])([a-z0-9&amp;\-_\.]+?)@([\w\-]+\.([\w\-\.]+)+)/i", "$1&lt;a href=\"mailto:$2@$3\"&gt;$2@$3&lt;/a&gt;", $text);  
return($text);  
}  
</code></pre>
