str_replace & regular expressions question

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi folks,

I am just writing to ask for help with something i'm trying to do with
a string.

I have a filename, for instance 'file.txt'.
However i'd like to make a script to take that file name and return it
as something like:
<a href= javascript:function('file.txt')>file.txt</a><br />

I have tried using PHP's str_replace function but I still can't seem to
get it right.

Does anyone know what I need to do to accomplish this?

Thank you all in advance.


Re: str_replace & regular expressions question

Mickey a écrit :

Quoted text here. Click to load it

It seems to easy to be what you expect but I try :
function getLink($filename)
{return "<a  
href=\"javascript:function('".$filename."')\">".$filename."</a><br />";}

Vincent Courcelle et

Re: str_replace & regular expressions question

Thank you Vincent  for that.
That solution was blatantly obvious.  I can't believe I didn't see it.

Thank's again for the help.

Kind Regards,

Site Timeline