Re: RFE to allow dirname($foo, 2)
| From: | Sara Golemon | Date: | Wed, 22 Jul 2015 18:49:27 +0000 |
| Subject: | Re: RFE to allow dirname($foo, 2) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-87235@lists.php.net to get a copy of this message | ||
On Wed, Jul 22, 2015 at 4:55 AM, Remi Collet <remi@fedoraproject.org> wrote:
> See https://bugs.php.net/bug.php?id=70112
>
I'm not inherently against it, but this really really sounds like a
job for a userspace function.
function dirname_n($path, $n) {
while (($path !== '.') && $n--) $path = dirname($path);
return $path;
}
-Sara