<?php $arr = [0, 1, 1, 0, 1]; var_dump(array_reduce($arr, function(int $carry, int $item) { return $item === 1 ? $carry + 1 : $carry; }, 0));
You have javascript disabled. You will not be able to edit any code.