I'm not sure if your $some_path variable is a string or an array but the problem likely stems from failing to provide the clean_path function with a reference (so that you could modify the var in the function).
metadoktor
"The doktor is in."
Comment on Failing to call a function with a reference?