On Wed, Jun 23, 2021 at 6:49 PM Sara Golemon <poll...@php.net> wrote:

> On Wed, Jun 23, 2021 at 9:15 AM Hamza Ahmad <office.hamzaah...@gmail.com>
> 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

Reply via email to