22.1 C
New York
Friday, August 19, 2022

How to check if string is URL or not in PHP?

- Advertisement -





Sometimes, we require to check the given argument or string is URL or not, as specially i did need to check image column is url or not like i give you example how to do this. If you also need to do this then you can use filter_var().

Example:

if(filter_var($imagePath, FILTER_VALIDATE_URL) === FALSE){

print_r("Not valide URL");

}else{

print_r("valide URL");

}

- Advertisement -

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles