December 8, 2011

PHP Explode, PHP End, File Name, File Extension

PHP Explode, PHP End, File Name, File Extension


if ( ! function_exists(‘file_parts’))
{
function file_parts($url,$params=’ext’)
{

if($params==’ext’)
{
$parts = explode(‘.’,$url);
return end($parts);
}
elseif($params==’name’)
{
$parts = explode(‘/’,$url);
return end($parts);
}
else
{
$parts = explode(‘/’,$url);
$file_name_ext = explode(‘.’,end($parts));
$file_name = array_pop($file_name_ext);
return implode(‘.’,$file_name);
}
}
}

Last updated: March 19, 2014
Did it helped? One thought on “PHP Explode, PHP End, File Name, File Extension
  1. Pingback: Website Designing Website Development internet explorer cannot download 704 from site

Comments are closed.