Re: [PHP-DEV] [RFC Discussion] array_change_keys()

2016-05-29 Thread Colin O'Dell
> > Yes there is: > array_combine( > array_map($someFunc, array_keys($arr), $arr), > $arr > ) > This way $someFunc gets key as first argument and value as second. (you > might use array_values($arr) instead of $arr but I’m not sure it’s worth it) > Good call! I have updated the RF

Re: [PHP-DEV] [RFC Discussion] array_change_keys()

2016-05-29 Thread Côme Chilliet
Le lundi 30 mai 2016, 01:40:21 Colin O'Dell a écrit : > Marco, > > > > 1. could you also provide the code for the benchmarks? I'd gladly measure > > them with an accurate tool > > > > Yeah that would be great! Here's the benchmark I was using: > https://gist.github.com/colinodell/872c1f0c92351

Re: [PHP-DEV] [RFC Discussion] array_change_keys()

2016-05-29 Thread Colin O'Dell
Marco, > 1. could you also provide the code for the benchmarks? I'd gladly measure > them with an accurate tool > Yeah that would be great! Here's the benchmark I was using: https://gist.github.com/colinodell/872c1f0c92351af687347c0c8be4f253 > 2. do we really need another array function tha

Re: [PHP-DEV] [RFC Discussion] array_change_keys()

2016-05-29 Thread Marco Pivetta
A bit skeptic here: 1. could you also provide the code for the benchmarks? I'd gladly measure them with an accurate tool 2. do we really need another array function that is basically an `array_combine(array_map($someFunc, array_keys($arr)), $arr)`? 3. and... do we really want another function t

Re: [PHP-DEV] Allow empty property names

2016-05-29 Thread Jakub Zelenka
On Tue, May 24, 2016 at 5:37 PM, Nikita Popov wrote: > On Sun, May 8, 2016 at 5:04 PM, Jakub Zelenka wrote: > >> Hi, >> >> I have been thinking about it and I would be ok with removing _empty_ in >> 7.1. That inconsistency is quite annoying and I never liked it. If we can >> rid of it, that woul

[PHP-DEV] [RFC] Add &$optind to getopt

2016-05-29 Thread as
Hello all, Many getopt implementations expose an `optind` variable to userland which contains the last argv index examined by the option parser. This is useful when mixing flag arguments with positional arguments, as it makes locating the positional arguments easy. For example, in C and Bash...

Re: [PHP-DEV] [RFC Discussion] array_change_keys()

2016-05-29 Thread Colin O'Dell
> > The RFC states "The new array returned by this function will contain the > same values in the same order, but with potentially different keys." > > But further down it states, that on multiple times the same key the last > one will "win". So in that special case it's **not** the same array > an

Re: [PHP-DEV] [RFC Discussion] array_change_keys()

2016-05-29 Thread Colin O'Dell
> > shouldn't it be possible to return null as new key? That way you say: > Use the next free integer index. > > Not sure if returning null is wanted (as it could hide errors in the > callback) or needed in some real world use cases. But it would be more > in sync with $a[] = ... > That's an inter

Re: [PHP-DEV] [RFC Discussion] array_change_keys()

2016-05-29 Thread Andreas Heigl
Hi all. Just one question for clarification: The RFC states "The new array returned by this function will contain the same values in the same order, but with potentially different keys." But further down it states, that on multiple times the same key the last one will "win". So in that special c

Re: [PHP-DEV] [RFC Discussion] array_change_keys()

2016-05-29 Thread Thomas Nunninger
Hello, shouldn't it be possible to return null as new key? That way you say: Use the next free integer index. Not sure if returning null is wanted (as it could hide errors in the callback) or needed in some real world use cases. But it would be more in sync with $a[] = ... Regards Thomas

Re: [PHP-DEV] [RFC Discussion] array_change_keys()

2016-05-29 Thread Colin O'Dell
> > Does this RFC really require a 2/3 majority? I mean, it does not change > the syntax or alters anything. It is just about a single new function? > > https://wiki.php.net/rfc/voting#required_majority > Good catch! You're right, this RFC only adds a single new function and does not modify the s

Re: [PHP-DEV] [RFC Discussion] array_change_keys()

2016-05-29 Thread Fleshgrinder
On 5/29/2016 3:13 PM, Colin O'Dell wrote: > I'd like to introduce a new RFC for your consideration and discussion: > https://wiki.php.net/rfc/array_change_keys This would add a new function > named array_change_keys() which simplifies the process of re-keying an > array. > +1 from my side, the s

[PHP-DEV] [RFC Discussion] array_change_keys()

2016-05-29 Thread Colin O'Dell
Hello everyone, I'd like to introduce a new RFC for your consideration and discussion: https://wiki.php.net/rfc/array_change_keys This would add a new function named array_change_keys() which simplifies the process of re-keying an array. PHP currently has an array_change_key_case() method, but t

Re: [PHP-DEV] [RFC][Vote] Typed Properties

2016-05-29 Thread Lester Caine
On 28/05/16 09:06, Lester Caine wrote: > class Person { > protected var $death; // var is intentional - my flag for a holder > $death->__type( DateTime, not_null = false ); > > To which one can add > $death->__limit( $birth, '120years' ); > Where $birth now has to be the same type and '120ye