Closed YuanchengJiang closed 58 minutes ago
Simplified:
<?php
$var = "hello";
$arrayWithRef = [];
$arrayWithRef[0] =& $var;
var_dump(array_find($arrayWithRef, fn () => true));
array_find
returns a reference in this case, but the function does not claim it can return a reference. The question is if this should indeed return a reference or should get rid of the reference. I would assume the latter but I need to think a bit.
Functions like array_shift
deref the result, so I think the new 8.4 array functions should as well.
Description
The following code:
Resulted in this output:
PHP Version
PHP 8.4.0-dev
Operating System
ubuntu 22.04