Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115112 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 72849 invoked from network); 24 Jun 2021 11:32:45 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Jun 2021 11:32:45 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C9CEE1804D8 for ; Thu, 24 Jun 2021 04:51:30 -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, 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-vk1-f182.google.com (mail-vk1-f182.google.com [209.85.221.182]) (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 ; Thu, 24 Jun 2021 04:51:30 -0700 (PDT) Received: by mail-vk1-f182.google.com with SMTP id k16so1231626vke.10 for ; Thu, 24 Jun 2021 04:51:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=fgp4QjLhxekSO2D4V0296uBuz0jHPHJQ182UyZ+WvUU=; b=EL9KFclF/i1afoUei0whi5KCzsdeeL27Gnc8hjJ3JC3WEc/cjkGtvye3LthcQlc4sb zYxiFsnjix1s/LfqnSV5+2Caaa5cbmD4xBKbVzws+Nk5fbBLs0FqeE9AU0dFiYKHvPHi mJ1UQ3Pa8VBXgko7iVo5xSZf5uy/sndhlXEWVzZhSMX3PIiPpTyL+0fdkizGMmAeivXw 9arlfWZRZRHODv1KXtKKHxj3FHhctvDHatVzIvMXo7DskKOiKuYf0wbDwmXEWWc7mSTS xcytfpQDGt5epe7KwtaUDAdt74sCrQZSlNmaqkghKI6odv9bazg1WIteBBDsHQvt6eVb MzNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=fgp4QjLhxekSO2D4V0296uBuz0jHPHJQ182UyZ+WvUU=; b=iSHosyaVAz2N291eyBqGanmR6c+OHkTM2MwJHOC7jFrR3hcSng7S/PumJatJ8CziF8 oVwBxt42hkVEPRjZnF9kqtMmblBsAnUsVHUUPfY81fQGPMgR8+vs+b/HZDA9hyumXwkN vtLmudktQgzWKUfQw1Zou08BDibGiLpHtiJGH84MBSXLA02weJa1ngYsbS58D5vd27L9 NuPEaVbVCevUgakZD3lESm1/NIdGxC+vUsEpO1DE899M/xZHu56WhPnbqN+f+8qOOTu5 mYYShtpSNMUBv34To7tAejcKBduXZrEslK3ZM6NS2zh9+rHB/ZHV1b6+JiyzlnL3T+Up sZEQ== X-Gm-Message-State: AOAM530e069LDSv75GfutpSSKjopyQAT4A+4dMJtDatJ/YfpCILlfEk4 Zy6CXwWIkiXMN+kyaZ1RPFD/FZUD53ugMHSzKlo= X-Google-Smtp-Source: ABdhPJxxLw4fE4f+Y1piyU7NZYnXwQtlwyNcRgMo4DOallIA8LTzYQ6Q2Ore10s/61wYOPMEFXtUL4jnssMY3AiBJvw= X-Received: by 2002:a05:6122:a1e:: with SMTP id 30mr1991697vkn.3.1624535489584; Thu, 24 Jun 2021 04:51:29 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab0:3b8f:0:0:0:0:0 with HTTP; Thu, 24 Jun 2021 04:51:29 -0700 (PDT) In-Reply-To: References: <012901d7683a$446a7ba0$cd3f72e0$@gmail.com> Date: Thu, 24 Jun 2021 16:51:29 +0500 Message-ID: To: Kamil Tekiela Cc: Guilliam Xavier , Sara Golemon , PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Introduce str_left/right In 8.1 From: office.hamzaahmad@gmail.com (Hamza Ahmad) HI Kamil, Thanks for the opinions. I have two questions: 1. Though it's true that naming choice is something to discuss about, is it really a big issue that can prevent from these functions to be introduced? We can ask both developers and user community about the name choice. 2. Since my basic goal is to have the functionality rather names, I would love to see more descriptive and concise names. What name do you suggest instead of these two? Because left and right are used in both MySQL and VB, a large number of people is already familiar with these names. However, I don't prefer this scheme because it can go against PHP's naming schemes. I know some of the string functions don't follow str_* and s* naming scheme. We can let democracy decide the right name. If PHP later has a string object, dev(s) can make left and right as its methods respectively. Best Hamza Ahmad On 6/24/21, Kamil Tekiela wrote: > I am against adding these functions, but for different reasons than Sara > and George. > If we add str_left and str_right then there should be a corresponding > variant in mbstring. The byte-string functions are rarely useful. Adding > these functions to mbstring unnecessarily complicates the extension for > little to no gain. > Another point is that if we decide to add them, then we will bikeshed > forever in an unresolvable manner about the name. Should it be called > str_left or strleft? Current functions don't have a naming convention, so > using either variant will be wrong. > Personally, I find substr to be more clear about the intent. I know that I > am asking for a part of the string. Whereas str_left doesn't convey an > action immediately. Without knowing its purpose I wouldn't know if it will > pad the string from the left, strip characters from left, or take the > leftmost part of the string. > Don't take it the wrong way, but I think it's a waste of time to implement > a function that doesn't even need a polyfill in the userland. > > Regards, > Kamil >