Valeur de retour incorrecte dans une méthode
Bonjour,
J'ai la méthode suivante:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| public static function getNameFromPath($path)
{
$path = "classes\\"; var_dump($path); // ligne pour test uniquement
if (empty($path))
{
return false;
}
else
{
var_dump(strrchr($path,'\\'));
var_dump(strtolower(substr(strrchr($path, '\\'), 1)));
if (strrchr($path, '/'))
return strtolower(substr(strrchr($path, '/'), 1));
elseif (strrchr($path, '\\'))
return strtolower(substr(strrchr($path, '\\'), 1));
else
return $path;
}
} |
Je ne comprends pas pourquoi la ligne 11 retourne une chaîne vide alors que les lignes 12 et 13 fonctionnent.