Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115074 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 61735 invoked from network); 23 Jun 2021 16:56:33 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Jun 2021 16:56:33 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9E4491804E3 for ; Wed, 23 Jun 2021 10:15:06 -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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 23 Jun 2021 10:15:06 -0700 (PDT) Received: by mail-lf1-f41.google.com with SMTP id f30so5400006lfj.1 for ; Wed, 23 Jun 2021 10:15:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=opA1XSoCDuVLjy02x1mgozR1rvBNilKWZUIjCTb98rA=; b=B0duzSONguEtEXvW3diiEwnRYt8qImJKADDnKZloldyn+4TcWqXZvip/+hFKchKFx1 XjozbfrzWZdZw39Z1oyHrBPsFKpHkIfUUKPOjWVO3XyBX0wJBO0sn9Sp/3S+iDlYJR2g iWTn+ddysqpsn0EEpXTsuRFFX8/kMZtt4ZsQfZ6dijmrIDug0drGOGmWEOg6eDwaTYlY 1V1S8qGZ0X0gZa7K/LqeqJwqkZ/+rY55zPBVbiHrBUrqzHtJcdpDIGcwXEDPIPNqwNK7 x2lxucoEaf9DODZ30FOlPNO4Tk9Dwj4WX0t/tjOA+OIwhQpv6ZsqEdFAUUs39LkGgnSD kInQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=opA1XSoCDuVLjy02x1mgozR1rvBNilKWZUIjCTb98rA=; b=aUWYd/J7bDoBmlTlFSBgDAlo1zEvfhlYhg6gLN+sSdKYUaT2NxKUQLYvT6KS9jsj9g 84Lv0XuByTxApArHverzRekxutZqLWeNBhCHyi7Qj4o91IJbyCDxKF1tlKkx0/2bLl9M u2NpMX+TmZCZwRZit6RdzYDV3CpFtHBDGvXk0B/iwJT7haHHrQYPGhUyW07jBS6pp9Yj 6VXHU5U6Up8C16GV1/PdqZGMOo2p03S2SxOMn702exVY/PmNh7zf4Qt/rk5vCEQYiofO OUh8wZ9E6bEf22uomeI4uORK5dhmV6m5usQZ0vSRfFxSxWOhJLvqgVoXgMUq29AiFdq0 +fVA== X-Gm-Message-State: AOAM533rZj87MHyCeWzOVFbTZjofu9MSmrBVKmwzpVUf8eFA7MESOy1Z HX0O/ZKLO/EsyGza24SMn/6CCIPG/dEnOnScwg== X-Google-Smtp-Source: ABdhPJwx8sIkTb0MIvR/gDs7qD1MvRwfHjjs/hbcaa1v8XeNIvLF0GH2j3UU5+IbHgmUy+smjngblJ8NLzj/kxlMoTs= X-Received: by 2002:a05:6512:169f:: with SMTP id bu31mr497772lfb.486.1624468502156; Wed, 23 Jun 2021 10:15:02 -0700 (PDT) MIME-Version: 1.0 References: <012901d7683a$446a7ba0$cd3f72e0$@gmail.com> In-Reply-To: Date: Wed, 23 Jun 2021 19:14:51 +0200 Message-ID: To: Sara Golemon Cc: Hamza Ahmad , PHP internals Content-Type: multipart/alternative; boundary="00000000000005179005c5720c55" Subject: Re: [PHP-DEV] Introduce str_left/right In 8.1 From: guilliam.xavier@gmail.com (Guilliam Xavier) --00000000000005179005c5720c55 Content-Type: text/plain; charset="UTF-8" On Wed, Jun 23, 2021 at 6:49 PM Sara Golemon wrote: > On Wed, Jun 23, 2021 at 9:15 AM Hamza Ahmad > wrote: > > > > > Since feature freeze for 8.1 is approaching, I want to request two useful > > string functions that exist in various languages-especially those that > run > > on web servers and used in databases. These are respectively `left();` > and > > `right();` > > > > > Sorry, you spent several paragraphs insisting that these are > common functions, but you didn't explain what they're meant to actually do. > > Using some context, I would assume you mean this: > > function str_left(string $str, int $len): string { > return substr($str, 0, $len); > } > > function str_right(string $str, int $len): string { > return substr($str, -$len); > } > I assume the same. > > If that's the case, then.... why? As you can see, the existing > functionality available is trivial to write. You don't even need to know > any particular amount of math (which I've been recently informed shouldn't > be a prerequisite to writing software -- shakes fist at clouds). > > Am I misunderstanding what these proposed functions should do, or am I > underestimating the difficulty of typing a zero or negative sign on certain > keyboards? > I think that's more about "semantics" ("conveying intent to readers") than typing... That said, I tend to agree with George (but maybe I'm "too" used to seeing substr()?) Regards, -- Guilliam Xavier --00000000000005179005c5720c55--