Re: Updating legacy code ...
| From: | Jonesy via php-general | Date: | Mon, 04 Mar 2019 16:59:27 +0000 |
| Subject: | Re: Updating legacy code ... | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-326729@lists.php.net to get a copy of this message | ||
On Mon, 4 Mar 2019 15:55:30 +0000, Lester Caine wrote:
> On 04/03/2019 15:18, Aziz Saleh wrote:
>> http://php.net/manual/en/function.count.php
>>
>> Returns the number of elements in array_or_countable. When the
>> parameter is neither an array nor an object with implemented Countable
>> interface, 1 will be returned. There is one exception, if
>> array_or_countable is NULL, 0 will be returned.
>>
>> If the item is null, it should indeed return 0.
>
> Except since 7.2.0 it issues a warning as well!
> Have to do
> echo count((array)$item);
> to shut it up ...
Isn't it just: @count($item) ???