Bug #70112 [Opn]: [RFE] Allow "dirname" to go up various time

From: Date: Wed, 22 Jul 2015 12:30:36 +0000
Subject: Bug #70112 [Opn]: [RFE] Allow "dirname" to go up various time
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194619@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70112&edit=1

 ID:                 70112
 Updated by:         remi@php.net
 Reported by:        remi@php.net
 Summary:            [RFE] Allow "dirname" to go up various time
 Status:             Open
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   irrevelant
 PHP Version:        7.0.0beta1
 Block user comment: N
 Private report:     N

 New Comment:

nb stands for number... but false friend from French, sorry.
I fine with any other name, like "levels"


Previous Comments:
------------------------------------------------------------------------
[2015-07-22 12:19:49] rowan dot collins at gmail dot com

Nice idea, but what on earth does "$nb" mean? I know parameter names of internal functions
only really exist in documentation, and can be easily changed, but we might as well try to make it
obvious. How about "$levels", or "$climb_levels", or spell out whatever
"nb" stands for (I'm not being sarcastic, I'm genuinely not sure)?

------------------------------------------------------------------------
[2015-07-22 11:46:26] remi@php.net

The following patch has been added/updated:

Patch Name: 0001-Fix-70112-RFE-Allow-dirname-to-go-up-various-time.patch
Revision:   1437565586
URL:        https://bugs.php.net/patch-display.php?bug=70112&patch=0001-Fix-70112-RFE-Allow-dirname-to-go-up-various-time.patch&revision=1437565586

------------------------------------------------------------------------
[2015-07-22 11:44:06] remi@php.net

Description:
------------
We can find tons of code with
   $a = dirname(dirname($b));
   $c = dirname(dirname(dirname(__DIR__)));
   etc

Could be nice to be able to write
   $a = dirname($b, 2);
   $c = dirname(__DIR__, 3);
   etc

Proposal: Add a new "nb" optional parameter.

    Function [ <internal:standard> function dirname ] {

      - Parameters [2] {
        Parameter #0 [ <required> $path ]
        Parameter #1 [ <optional> $nb ]
      }
    }

As a minor, self-contained change, could probably target 7.0




------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=70112&edit=1


Thread (11 messages)

« previous php.bugs (#194619) next »