- array_map: documentation ( source)
- implode: documentation ( source)
- explode: documentation ( source)
- array_pop: documentation ( source)
- ucfirst: documentation ( source)
<?php
$path = 'entrega/importacao/importacao.class.php';
if (count(explode('/', $path)) > 1) {
$path = explode('/', $path);
$file = array_pop($path);
$path = array_map(function($word) { return ucfirst($word); }, $path);
$path = implode('/', $path) . '/' . $file;
}
echo $path;