Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84323 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92736 invoked from network); 5 Mar 2015 08:29:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Mar 2015 08:29:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.161 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.161 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.161] ([81.169.146.161:19587] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 59/84-56703-3F318F45 for ; Thu, 05 Mar 2015 03:29:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1425544176; l=5358; s=domk; d=kelunik.com; h=Content-Type:Cc:To:From:Subject:Date:References:In-Reply-To: MIME-Version; bh=MOZfWc6x+OgJGu2iNKaJocQnkMYd5f0aQYcZumYGzU8=; b=v5RwAp7cnft0keTaudcMf34zAbY5smB1Cpfo6HrRaUFxPwTzodZDoAUSVuLSsk4gDeX AVQdDnixctMIGqJWt3uWOEQJKLWGE0JTg9/JPRBhiDFNjKHZyBPlJ945MBnDVCJOrAdBx P9Rxk4bTr8srm9J5u0dC1NBx3LL9yh8SMVM= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLDup6E67mzuoNNBqD/tX0= X-RZG-CLASS-ID: mo00 Received: from mail-wi0-f175.google.com ([209.85.212.175]) by smtp.strato.de (RZmta 37.3 AUTH) with ESMTPSA id w06812r258TaBdc (using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) for ; Thu, 5 Mar 2015 09:29:36 +0100 (CET) Received: by widem10 with SMTP id em10so34342161wid.0 for ; Thu, 05 Mar 2015 00:29:36 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.180.21.162 with SMTP id w2mr4183133wie.66.1425544176330; Thu, 05 Mar 2015 00:29:36 -0800 (PST) Received: by 10.27.187.85 with HTTP; Thu, 5 Mar 2015 00:29:36 -0800 (PST) In-Reply-To: References: Date: Thu, 5 Mar 2015 09:29:36 +0100 Message-ID: To: Yasuo Ohgaki Cc: Benoit Schildknecht , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=047d7b8750803decba0510865ed5 Subject: Re: [PHP-DEV] Re: [RFC] [DISCUSSION] Consistent Function Names From: me@kelunik.com (Niklas Keller) --047d7b8750803decba0510865ed5 Content-Type: text/plain; charset=UTF-8 If we introduce those new aliases, it should be clearly stated in the docs which function should be used, maybe we can remove the old one in the far future then. But the more important point is, that it's not that confusing to users. Which one should I use? Why's there another one? We already have that situation with `count` and `sizeof`. Regards, Niklas 2015-03-05 9:07 GMT+01:00 Yasuo Ohgaki : > Hi Benoit, > > On Wed, Mar 4, 2015 at 2:34 AM, Benoit Schildknecht > 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 > yohgaki@ohgaki.net > --047d7b8750803decba0510865ed5--