Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-25 Thread G. P. B.
On Fri, 25 Jun 2021 at 08:26, Hamza Ahmad wrote: > To George > > > substring of the original string. And by that logic left and right are > > actually linguistically incorrect due to languages being read Right to > Left > > or Top to Bottom. > > Thanks George for pointing out an important aspect

Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-25 Thread Hamza Ahmad
> #justsaying Mike, most of the developers in PHP have their background from web development, and they need easier solutions to their problems. As for your suggestion of including all suggested names in the RFC, I shall do this, too! Like others, I do have a dream for PHP that it may become an ad

Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-25 Thread Hamza Ahmad
To George > substring of the original string. And by that logic left and right are > actually linguistically incorrect due to languages being read Right to Left > or Top to Bottom. Thanks George for pointing out an important aspect regarding the choice of names. Will you consider a vote if there

Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-24 Thread Mike Schinkel
> On Jun 24, 2021, at 8:04 AM, G. P. B. wrote: > > Moreover, the fact that only a very restricted number of programming > languages, which are some of the earliest languages ever, implement those > functions should tell you something about programming language design > as a whole, which is that m

Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-24 Thread Hamza Ahmad
> I can also imagine bikeshed... This is what can be discussed apart from whether these function come to PHP. I am waiting for the other voices; there is surely someone that can come up with a more creative name, a name that is short yet descriptive. > str_left_part/str_right_part is just what ca

Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-24 Thread G. P. B.
On Thu, 24 Jun 2021 at 07:20, Hamza Ahmad wrote: > HI George, > > > I really don't see the point of these functions. > > These functions provide a clearer semantics for their usage. Are they though? The naming doesn't convey anything as pointed out by Kamil. > Substr, > as Sara has mentioned

Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-24 Thread Andreas Leathley
On 24.06.21 13:17, 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 u

Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-24 Thread 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 goa

Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-24 Thread Guilliam Xavier
On Thu, Jun 24, 2021 at 1:17 PM 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

Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-24 Thread Kamil Tekiela
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

Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-24 Thread Guilliam Xavier
On Thu, Jun 24, 2021 at 12:51 AM Sara Golemon wrote: > > [...] I'm > not going to vote for it though, because it belongs in composer/packagist > land, not in core. I've listed the reasons for this in the str_contains() > threads, feel free to reference those, they're still valid and correct. >

Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-24 Thread Guilliam Xavier
On Wed, Jun 23, 2021 at 11:54 PM Rowan Tommins wrote: > On 23/06/2021 22:28, Christoph M. Becker wrote: > > substr() is about bytes, not characters. They all may have upvoted the > > wrong answer. The only correct answer has just 17 upvotes. > > > Just to out-pedant you, I'll point out that wha

Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-23 Thread Hamza Ahmad
To George, et al, HI George, > I really don't see the point of these functions. These functions provide a clearer semantics for their usage. Substr, as Sara has mentioned, can be an alternative to these functions. Does it make clear that substr returns the either ends of a string? No, substr ret

Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-23 Thread Sara Golemon
On Wed, Jun 23, 2021 at 2:10 PM Mike Schinkel wrote: > I have frequently heard the justification of maintenance burden mentioned > as an objection to adding specific features. And in many cases, it is easy > to see why future maintenance burden would be a concern. > > However, it *seems* in this

Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-23 Thread Rowan Tommins
On 23/06/2021 22:28, Christoph M. Becker wrote: substr() is about bytes, not characters. They all may have upvoted the wrong answer. The only correct answer has just 17 upvotes. Just to out-pedant you, I'll point out that what most people would think of as a "character" is neither a byte no

Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-23 Thread Christoph M. Becker
On 23.06.2021 at 21:10, Mike Schinkel wrote: > Replying to both Sara's and G.P.B.'s emails below: > >> On Jun 23, 2021, at 12:48 PM, Sara Golemon wrote: >> >> Using some context, I would assume you mean this: >> >> function str_left(string $str, int $len): string { >> return substr($str, 0, $len

Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-23 Thread Mike Schinkel
Replying to both Sara's and G.P.B.'s emails below: > On Jun 23, 2021, at 12:48 PM, Sara Golemon wrote: > > 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)

Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-23 Thread Guilliam Xavier
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 u

Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-23 Thread Sara Golemon
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();` >

Re: [PHP-DEV] Introduce str_left/right In 8.1

2021-06-23 Thread G. P. B.
On Wed, 23 Jun 2021 at 15:15, Hamza Ahmad wrote: > Hello Internals, > > 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();` a