array_find is a useful function, but only available in PHP 8.4 or later. Here we implement it ourselves if it's not already defined, to make it available for all supported PHP versions.