Re: RFE to allow dirname($foo, 2)
| From: | Marco Pivetta | Date: | Wed, 22 Jul 2015 18:57:23 +0000 |
| Subject: | Re: RFE to allow dirname($foo, 2) | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-87236@lists.php.net to get a copy of this message | ||
On 22 July 2015 at 19:49, Sara Golemon <pollita@php.net> wrote:
> 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;
> } <http://www.php.net/unsub.php>
>
>
Indeed.
What need is there to add a functionality to a relatively simple function
like this one?
What's the actual advantage that cannot be achieved in userland code?
Greets,
Marco Pivetta
http://twitter.com/Ocramius
http://ocramius.github.com/