Get Extension of File Path using PHP

pathinfo function

<?php

$path = '/var/tmp/archived.tar.gz';
$extension = '.'.pathinfo($path, PATHINFO_EXTENSION);

echo $extension;

Leave a Comment

Cancel reply

Your email address will not be published.