[PHP] pobierz, plaintext <?php$liczby = array(95, 0, 0, 86, 55, 777, 0);?>[PHP] pobierz, plaintext
[PHP] pobierz, plaintext <?php$ilosc = 0;foreach($liczby as $val){if($val > 0){$ilosc += 1;}}// zmienna $ilosc zawiera ilosc wartosci wiekszych od 0?>[PHP] pobierz, plaintext
[PHP] pobierz, plaintext <?php function greaterThenZero($array) { $counter = 0; foreach ($array as $row) { if (0 < $row) $counter++; } return $counter;} $liczby = array(95, 0, 0, 86, 55, 777, 0);echo greaterThenZero($liczby); ?>[PHP] pobierz, plaintext
[PHP] pobierz, plaintext <?phpfunction niezerowe($var){ if($var > 0) return $var;} $tablica1 = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);echo count(array_filter($tablica1, "niezerowe"));?>[PHP] pobierz, plaintext
[PHP] pobierz, plaintext <?phpfunction niezerowe($var) { return 0 < $var;}?>[PHP] pobierz, plaintext