get extension from filename php 1

get extension from filename php

$ext = pathinfo($filename, PATHINFO_EXTENSION);

Here is what the above code is Doing:
1. We’re using the pathinfo() function to get the extension of the file.
2. We’re passing the $filename variable as the first argument to the pathinfo() function.
3. We’re passing the PATHINFO_EXTENSION constant as the second argument to the pathinfo() function.
4. We’re storing the extension in the $ext variable.

Similar Posts