Käynnissä

Simple PHP function

For my website I need a simple PHP function.

DESCRIPTION:

I need for my website a PHP function to replace text. The function will find any URL inside a string variable and then replace the URL with a second string variable.

For example:

function urlReplace($text, $replaceWith)

then...

$text = "Check this website: [url removed, login to view]"

$replaceWith = '<a href="{0}">{0}</a>'

echo urlReplace($text, $replaceWith)

// Will print on screen "Check this website: <a href="[url removed, login to view]">[url removed, login to view]</a>"

The {0} will be replaced by the URL finded.

If the $replaceWith have a {1} then the URL will be passed to another function called transformURL($url) before print it. This second function will be created by ME.

For example:

Imagine that the transformURL it's defined like this:

function transformURL($url) {

return strtoupper($url);

}

...then...

$text = "Check this website: [url removed, login to view]"

$replaceWith = '<a href="{0}">{1}</a>'

echo urlReplace($text, $replaceWith)

// Will print on screen "Check this website: <a href="[url removed, login to view]">HTTPS://[url removed, login to view]</a>"

IMPORTANT INFORMATION:

- The function it's necesary to word in PHP 5.4

- If the input string have more than one URL then all URLs will be replaced.

- The URL may be a simple "[url removed, login to view]" or a complex like "[url removed, login to view]"

- ANY SUGGESTION IT IS WELCOME.

Taidot: PHP

Näytä lisää: php ar, my ar, function, fotos, check input function php, function check php, word find function, simple print function, php echo print, simple find replace php, php return, word find replace, string function, complex php, simple text replace, inside php, complex screen, php function check url, text jpg php, simple word find, simple function php wordpress, simple php function, php print information, url jpg php, website function description

About the Employer:
( 11 reviews ) Buenos Aires, Argentina

Projektin tunnus: #1734361

Myönnetty käyttäjälle:

dtbang

Can be done within 1 hour.

30 $ USD 0 päivässä
(26 arvostelua)
4.8

10 freelanceria on tarjonnut keskimäärin 64 $ tähän työhön

solutionswithus

please provide a chance to work with you.We have developed a lot site as : http://www.iphone.solutionswithus.in/ http://www.magento.solutionswithus.in/ http://www.property.solutionswithus.in/ Hope for good resp Lisää

30 $ USD 1 päivässä
(11 arvostelua)
7.1
dinotech

We are working in web development since last 4 years. Our first aim is reliable to submit quality project on time; Some of the Projects done by us:- 1.http://e-ternity.com.au/ (Zend) 2.http://www.promus.hr/gea_new2/ Lisää

250 $ USD 5 päivässä
(108 arvostelua)
7.1
Max01

hi sir i can do it today,gladly waiting to serve you

30 $ USD 0 päivässä
(99 arvostelua)
5.8
JonnyTheDreamer

Hi. Ready to help.

30 $ USD 2 päivässä
(33 arvostelua)
5.6
zavakid

hi,juanchipehuajo develope PHP 3+ years, will do this job for you. please check my private message :)

30 $ USD 1 päivässä
(10 arvostelua)
3.9
avj1989

Can do this very well ASAP. Please have a look to your PM. Thank you

80 $ USD 2 päivässä
(7 arvostelua)
3.1
brianbradley

This will be a quick job.

30 $ USD 1 päivässä
(1 arvostelu)
1.3
pzycodez

Ready to start now. Please check PMB.

30 $ USD 0 päivässä
(0 arvostelua)
0.0
LokkiUA

It'll be very quick job

100 $ USD 0 päivässä
(0 arvostelua)
0.0