hercioneto

exercicio.php

Jun 11th, 2018
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.35 KB | None | 0 0
  1. <?php
  2. /*
  3. Dado um array com os seguintes valores
  4. 56
  5. 78
  6. 90
  7. 34
  8. 36
  9. 45
  10. 78
  11. 90
  12. 32
  13. 17
  14.  
  15. Verificar o indice dos numeros que são maiores
  16. que 50.
  17. Imprimir o indice e o valor
  18. */
  19.  
  20. $meuArray = array(56,78,90,34,36,45,78,90,32,17);
  21. for ($i=0; $i<count($meuArray); $i++) {
  22.     if ($meuArray[$i]>50)
  23.     { echo "$i $meuArray[$i]";
  24.     echo "<br>";
  25.     }
  26. }
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment