Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120538 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 96190 invoked from network); 8 Jun 2023 06:35:05 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Jun 2023 06:35:05 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F0558180209 for ; Wed, 7 Jun 2023 23:35:03 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS34011 80.237.132.0/24 X-Spam-Virus: No X-Envelope-From: Received: from wp160.webpack.hosteurope.de (wp160.webpack.hosteurope.de [80.237.132.167]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 7 Jun 2023 23:35:02 -0700 (PDT) Received: from [2a02:8109:9d40:1d44:40b6:f5d3:c567:d46c]; authenticated by wp160.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) id 1q79Eb-0000qD-4P; Thu, 08 Jun 2023 08:35:01 +0200 Message-ID: <5b37626b-1157-e453-d434-4a68916dafc8@mabe.berlin> Date: Thu, 8 Jun 2023 08:35:00 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 To: internals@lists.php.net References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-bounce-key: webpack.hosteurope.de;marc@mabe.berlin;1686206103;4cc0a72f; X-HE-SMSGID: 1q79Eb-0000qD-4P Subject: Re: [PHP-DEV] [RFC] [VOTE] Define proper semantics for range() function From: marc@mabe.berlin (Marc) On 01.06.23 18:16, G. P. B. wrote: > Hello internals, > > The vote for the Define proper semantics for range() function RFC is now > open and will last for two weeks until the 15th of June 2023: > > https://wiki.php.net/rfc/proper-range-semantics > > Best regards, > > George P. Banyard > Hi George, sorry for speaking up so late but I think the following change is a mistake and unexpected: > Calls to range() that have integer boundaries but a float step that is compatible as an integer will now return an array of integers instead of an array of floats: var_dump( range(1, 5, 2.0) ); /* New Behaviour */ array(3) {   [0]=>   int(1)   [1]=>   int(3)   [2]=>   int(5) } /* Current Behaviour */ array(3) {   [0]=>   float(1)   [1]=>   float(3)   [2]=>   float(5) } The problem I see with this is that the return type changes from float to int "magically" based on the value of the step. range(1, 5, 2.0) // list range(1, 5, 2.1) // list In my opinion, no matter, if start, end or step is a float the result should be a list. Thanks, Marc