- basename: documentation ( source)
- explode: documentation ( source)
- setlocale: documentation ( source)
- array_pop: documentation ( source)
- mb_internal_encoding: documentation ( source)
<?php
mb_internal_encoding('UTF-8');
setlocale(LC_ALL, 'utf8');
function gorramBasename($path)
{
$components = explode('/', $path);
return array_pop($components); // ugly, but more multibyte-safe than basename()
}
$path = 'šašek.txt';
echo basename($path) . "\n";
echo gorramBasename($path) . "\n";