Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Captura um nome de arquivo de devolve um array de 2 elementos com o nome e extensão.
function GetFileParts($file_name)
$tmp = explode("/", $file_name);
$_filename = array_pop($tmp);
$tmp = explode(".", $_filename);
$ext = array_pop($tmp);
$fil = substr($_filename, 0, ((strlen($ext)+1) * -1));
$r = array();
$r["name"] = $fil;
$r["ext"] = $ext;
return $r;
$arquivo = "/folder/subfolder/";
echo $arquivo . "<br/>";
echo "<pre>";
echo "</pre>";
[name] =>
[ext] => php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.