Hi Benoit,

On Wed, Mar 4, 2015 at 2:34 AM, Benoit Schildknecht <bensor...@neuf.fr>
wrote:

> I think the new functions must have consistent parameters order too. I
> think it is about the right time, so we'll have a cleaner and more logical
> language.
>
> ATM, it's a real headache, we constantly have to read the documentation to
> make sure we give the arguments in the right order.
>
> For instance
> - implode() : "implode() can, for historical reasons, accept its
> parameters in either order. "
> - strpos( $haystack, $needle )
> - in_array( $needle, $haystack )
>

$needle should be 2nd argument like

int strpos  ( string $haystack  , mixed $needle  [, int $offset= 0  ] )
string stristr ( string $haystack , mixed $needle [, bool $before_needle =
false ] )

Rasmus suggested to have IEEE 1003.1 compliance. I like the idea and I'll
add
this in the RFC, probably. These are the order of parameters.

So array functions are subject to be changed.

bool in_array  ( mixed $needle  , array $haystack  [, bool $strict  ] )
Renamed to array_in() and fix order.

mixed array_search  ( mixed $needle  , array $haystack  [, bool $strict  ] )
Renamed to array_find() and fix order.

bool array_key_exists ( mixed $key , array $array )
Renamed to array_key_find() and fix order.

array array_keys ( array $array [, mixed $search_value [, bool $strict =
false ]] )
OK as it is now.

implode() may be changed to have
string implode ( string $glue , array $pieces )
always.

If there are missing functions, please let me know.
I'll try to address.

Regards,

--
Yasuo Ohgaki
yohg...@ohgaki.net

Reply via email to