fork(3) download
  1. <?php
  2.  
  3. $array = array(
  4. 1=>'',
  5. 2=>2,
  6. 3=>null,
  7. 4=>4,
  8. 5=>'');
  9.  
  10. $i = 0;
  11. foreach($array as $item){
  12. if(empty($item)){
  13. $i++;
  14. }
  15. }
  16.  
  17. echo "count empty elements:". $i;
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
count empty elements:3