Hey Benjamin,

On Tue, 25 Jun 2024 at 22:24, Benjamin Morel <benjamin.mo...@gmail.com>
wrote:

>
> I predicted this would probably be on the agenda. Another idea is to pass
>> arguments by reference, like in `exec()`.
>>
>> Personally, I find something like a tuple easier to use. However, without
>> generics, all we know is that the return type is an array, which may be
>> inconvenient in terms of IDE completion, etc.
>>
>
> As for tuple vs reference, I think the general direction is to move away
> from references as much as possible, and AFAIK references actually make
> things harder for IDEs and static analysis tools, whereas the tuple syntax
> array{string, string} is well understood at least by PhpStorm, Psalm and
> PHPStan, which can correctly type the function's return value in their
> stubs.
>

Full ack on this.

I'm wondering if an array vs an object allocation makes a difference here,
or if the amount of `bcdivmod()` execution dwarfs this sort of concern?

Thinking:

```php
$result = \bcdivmod('123', '2');

echo $result->quotient; // '61'
echo $result->remainder; // '1'
```

No idea if that's relevant, so I'm throwing it in the room.

Marco Pivetta

https://mastodon.social/@ocramius

https://ocramius.github.io/

Reply via email to