<?php
function filepath($filepath) {
$fileparts = pathinfo($filepath);
if (!isset($fileparts['filename'])) {
$fileparts['filename'] = substr($fileparts['basename'], 0, strrpos($fileparts['basename'], '.'));
}
return $fileparts;
}
$test = $_SERVER['SCRIPT_FILENAME'];
$filepath = filepath($test);
print_r($filepath);
/*
Array (
[dirname] => Z:/home/localhost/www
[basename] => testfp.gz.me.my.php
[extension] => php
[filename] => testfp.gz.me.my
)
*/
?>