[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-internals
Subject:    [PHP-DEV] Character range syntax ".." for character masks
From:       mickmackusa <mickmackusa () gmail ! com>
Date:       2022-07-29 5:15:17
Message-ID: CAKVXxD-bybL4wfGe1yGGF4YgSNpET1y_6BHJnhhQAmytwtiNDA () mail ! gmail ! com
[Download RAW message or body]


On Monday, July 25, 2022, Guilliam Xavier <guilliam.xavier@gmail.com> wrote:

> On Sat, Jul 9, 2022 at 1:56 AM mickmackusa <mickmackusa@gmail.com> wrote:
>
>> I've discovered that several native string functions offer a character
>> mask
>> as a parameter.
>>
>> I've laid out my observations at
>> https://stackoverflow.com/q/72865138/2943403
>>
>
> Out of curiosity, why do you say that strtr() is "not a good candidate
> because character order matters" (although you give a reasonable example)?
> Maybe you have some counter-example?
>
> Regards,
>
> --
> Guilliam Xavier
>

I prefer to keep my scope very tight when posting on Stack Overflow.

My focus was purely on enabling character range syntax for native functions
with character mask parameters.  My understanding of character masks in PHP
requires single-byte characters and no meaning to character order.

When strtr() is fed two strings, they cannot be considered "character
masks" because the character orders matter.

If extending character range syntax to parameters which are not character
masks, I might support the feature for strtr(), but ensuring that the two
strings are balanced will be made more difficult with ranged syntax.
strtr() will silently condone imbalanced strings.  https://3v4l.org/PY15F


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic