user1022585
user1022585

Reputation: 13651

php find out if array contains values of over 0?

Without looping through each value in an array, is there any shortcut to checking whether it contains values over 0?

Eg

array(3,0,0) would be TRUE

array(0,0,0) would be FALSE

array(-2,0,-3) would be FALSE

Upvotes: 2

Views: 1224

Answers (1)

PeeHaa
PeeHaa

Reputation: 72682

if (max(array(3,0,0)) > 0) echo 'greater than 0';

Upvotes: 22

Related Questions