Check if String Contains Link - Php

Check if string has link

Snippet Code

Rate this page :
  [ 0 votes]

This php code can be used to check if string contains link or not. Here, alert is also displayed if string contains link.

<?php $str="hscripts hiox"; if(preg_match("/[wd.] .(com|org|ca|net|uk)/", $str)) { echo "This String contain url.."; } else { echo "Valid String"; } ?>


Ask Questions

Ask Question