=> nerds only A blog on rails, php, computing, my bass guitar and stuff

Php function for checking a string for an url

on in Development, PHP

Hi, Under the link “read more” you can find a self-written function that checks a string for url’s. I don’t know what to say more. I think it explains itself. It is very simple and I tried to make it as fast as possible.

It first checks the string for simple things like ‘http’ and ‘www’. After that it searches the string for a topleveldomain with a point in front of it. So, the string: ‘’ will be recognized as an url.

If anybody has any suggestions to make it better, I will be glad to hear them.

If you would like to see more php scripts here, please contact me and keep visitingthis website!