Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115072 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 57427 invoked from network); 23 Jun 2021 16:30:34 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Jun 2021 16:30:34 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 70DFC1804C3 for ; Wed, 23 Jun 2021 09:49:07 -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=3.2 required=5.0 tests=BAYES_20, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (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 09:49:06 -0700 (PDT) Received: by mail-lf1-f48.google.com with SMTP id j4so5185178lfc.8 for ; Wed, 23 Jun 2021 09:49:06 -0700 (PDT) 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=12ZV62qyxHj6v84l2naiZ3wWWjNmboJDNIIeIFEcdGI=; b=KW3G22p1R7SRwa8qJ+TJw12H15xgNMKc/TNBNVmZBzav2WmOjxsptqJzZ95KkTy1TG eADT/ksNl6ILVOviqr/PpHpDOv/v0mgKAyZmemYHepkS2yrNAZkG5LFBBhqRL01zoMlW oOtv1+baYXtGePCLB3j8/gjmTUxPzVrLr8G0QsoyBpGFVNBu3gVk/KfYGvjeQKCTLBsC zw/og/IpaLaQnrw0FU42rAmMDW/lMIxbGFoHmMMb47DR29mAg7BkjiN3LxF1psbypcQf PXJJfCiLR45bFSfsfQZlLM2XqWAb6IRuxUjWozimLR5yP0CjPKXjk0gdLNqD/kJL4SNa LbtA== X-Gm-Message-State: AOAM5315ybnvy9MuObYiNMiexeWATXuZi9/cnSLZGXRPCc2JuQJGKIkO Rq8TtNdk6PGByXj5SWh/tidm3Mblq09iIVOvbljM6A== X-Google-Smtp-Source: ABdhPJzSi3Pps08goyrFH9sujA+CQVNt1qe8Cz7CZX0Lap2SvwUnGGxNhDgt5BrDaWaCzogKS8JOb8HLDV7r2HVOKUE= X-Received: by 2002:ac2:4a61:: with SMTP id q1mr405624lfp.572.1624466944960; Wed, 23 Jun 2021 09:49:04 -0700 (PDT) MIME-Version: 1.0 References: <012901d7683a$446a7ba0$cd3f72e0$@gmail.com> In-Reply-To: <012901d7683a$446a7ba0$cd3f72e0$@gmail.com> Date: Wed, 23 Jun 2021 11:48:54 -0500 Message-ID: To: Hamza Ahmad Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000343d3105c571afa9" Subject: Re: [PHP-DEV] Introduce str_left/right In 8.1 From: pollita@php.net (Sara Golemon) --000000000000343d3105c571afa9 Content-Type: text/plain; charset="UTF-8" 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); } 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? -Sara --000000000000343d3105c571afa9--