I was today old when I discovered the big difference between strchr and
strrchr in the way they handle needle with multiple characters.
It's explained in the doc https://www.php.net/manual/en/function.strrchr.php
- If needle contains more than one character, only the first is used. This
behavior i
27;
Le ven. 16 août 2024 à 01:04, Rob Landers a écrit :
> On Thu, Aug 15, 2024, at 17:42, Vincent Langlet wrote:
>
> Hi,
>
> When string is used as an array key, it's sometimes casted to an int.
> As explained in https://www.php.net/manual/en/language.types.array.php:
> &
Hi,
When string is used as an array key, it's sometimes casted to an int.
As explained in https://www.php.net/manual/en/language.types.array.php:
"Strings containing valid decimal ints, unless the number is preceded by
a + sign, will be cast to the int type. E.g the key "8" will actually be
stored
Hi,
There was an RFC about more appropriate date exceptions
https://wiki.php.net/rfc/datetime-exceptions
implemented in
https://github.com/php/php-src/commit/66a1a911f1d6cd4b89c0bb5577fa77f1d6a2cb96
Looking at PHP example, it updated method return types like
- Datetime::modify
- DatetimeImmutable
Hi,
IMHO, the more meaningful cases of the RFC are missing :
round(float, precision: >= 0): int|float // only cast to float for int overflow
ceil(float): int|float // only cast to float for int overflow
floor(float): int|float // only cast to float for int overflow
Calling ceil or floor on integ
Hi,
When using json_encode or json_decode with the `JSON_THROW_ON_ERROR` flag,
`JsonException` might be thrown.
When using `new DateTime('foo')`, a generic `Exception` is thrown.
Incidentally, I wonder why it's not an `InvalidArgumentException` (but that
could be another debate).
But my main poi
> On 6 January 2022 07:29:58 GMT, James Titcumb wrote:
> >Just thinking out loud, being able to identify an array type might be a
> way
> >forward here (using "syntax" already in use by static analysis tools in
> >docblocks, for familiarity), e.g.
> >
> >private array $property;
> >
> >This might
> It'd not be just a BC break, it'd be an absolutely massive BC break that
> has a potential to break a ton of code and would be extremely hard to
> detect. This is not something that should be changed in an advanced
> version of the language.
>
Would you still consider this as a massive BC break
> On 29/12/2021 16:58, Lynn wrote:
> > While I'd love for this inconsistency to go away, I also know that this
> is
> > most likely such a big change that it causes months of work and broken
> code
> > because it relies on this behavior. It wouldn't surprise me if this
> > singular change would cau
Hi,
I recently discovered that an array was automatically casting
numeric-string keys to int if it was possible. For instance, the following
array:
$a = ['01' => '01', '10' => '10'];
Is not an array with the key '01' and '10' but instead consider the second
key as an int.
This has some implicat
10 matches
Mail list logo