jquery getting url parameters & value

Hi guys , here I am going to share a simple php function which is taken care of our fixing url/links problem.

This function will add http or https in front of urls which doesnt hav.

Here is the PHP code

function fix_url($url) {
 if (substr($url, 0, 7) == 'http://') { return $url; }
 if (substr($url, 0, 8) == 'https://') { return $url; }
 return 'http://'. $url;
 }

Usage

 <?php echo fix_url('www.google.com'); ?> 

Output

 http://www.google.com 

Please don’t forget to share and subscribe to latest updates of the blog. Comments and feedbacks are always welcome!

Thanks!

If you enjoyed this article, Get email updates (It’s Free)
http://w3lessons.info/wp-content/uploads/2013/02/jquery-getting-url-parameters-value.jpghttp://w3lessons.info/wp-content/uploads/2013/02/jquery-getting-url-parameters-value-150x150.jpgKarthikeyan KPHPphp,tips & tricks
Hi guys , here I am going to share a simple php function which is taken care of our fixing url/links problem. This function will add http or https in front of urls which doesnt hav.Here is the PHP codeUsageOutputPlease don’t forget to share and subscribe to latest updates of the blog....