Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $miarray = array(
- 128 => 1,
- 64 => 0,
- 32 => 1,
- 16 => 0,
- 8 => 1,
- 4 => 1,
- 2 => 1,
- 1 => 0, );
- $suma=0;
- foreach ($miarray as $indice => $clave)
- { if($clave==1){
- $suma += $indice;
- }
- }
- echo $suma;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement