Home >Backend Development >PHP Tutorial >How to check if file is video type in php?
Let us assume that the following are our variables in which we have a .mp4 path file −
$movieFileType="demo.mp4";
To check if the above file is of video type, use end( ) and explode(). You need to set this condition in strtolower() and check the condition −
if(strtolower(end(explode(".",$movieFileType))) =="mp4") { } else { }
This will produce the following output −
The movie demo.mp4 is of video type.
The above is the detailed content of How to check if file is video type in php?. For more information, please follow other related articles on the PHP Chinese website!