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 <tekiela...@gmail.com> 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
>

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to