vendredi 11 novembre 2016

Count Number of Items In array above 0

I have an array

array:3 [▼
  1 => "2"
  2 => "2"
  3 => "0"
]

I want to count the number of keys which have the value over 0. In the above example I should have the answer 2.

Here's my attempt.

return count($input_items > 0);

This returns 1



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire