Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/myscript/public_html/codes-snippets/config.php on line 6
Check if String Contains Link - Php

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 https://www.hscripts.com"; if(preg_match("/[wd.] .(com|org|ca|net|uk)/", $str)) { echo "This String contain url.."; } else { echo "Valid String"; } ?>

Tags


Ask Questions

Ask Question