Re: Allow zero parameters in array_merge()?
| From: | G. P. B. | Date: | Fri, 14 Jun 2019 17:26:36 +0000 |
| Subject: | Re: Allow zero parameters in array_merge()? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-105931@lists.php.net to get a copy of this message | ||
On Fri, 14 Jun 2019 at 19:21, Sara Golemon <pollita@php.net> wrote:
> On Fri, Jun 14, 2019 at 12:15 PM Benjamin Morel <benjamin.morel@gmail.com>
> wrote:
>
> > I'm wondering if there's any reason why array_merge() doesn't allow zero
> > arrays to be passed?
> >
> > array_merge(); // Warning: array_merge() expects at least 1
> parameter,
> > 0 given
> >
> > It would be reasonable IMO to return an empty array in this case.
> >
>
> I don't see any issue with this plan. I say do it.
>
> -Sara
>
Already the case in PHP 7.4
See changelog:
https://www.php.net/manual/en/function.array-merge.php#refsect1-function.array-merge-changelog
George P. Banyard