fork download
  1. <?php
  2. $adultos = array( "a", "b", "c" );
  3. $i = 1;
  4. foreach ($adultos as $adulto):
  5. echo "<strong>Quarto " . $i++ . "</strong><br>";
  6. echo "Adultos: " . $adulto . "<br>";
  7. endforeach;
  8.  
  9. for ($i = 0; $i < count($adultos); $i++) {
  10. echo "<strong>Quarto ". ($i + 1) ."</strong><br>";
  11. echo "Adultos: " . $adultos[$i] . "<br>";
  12. }
  13.  
  14. //https://pt.stackoverflow.com/q/238483/101
Success #stdin #stdout 0.01s 82880KB
stdin
Standard input is empty
stdout
<strong>Quarto 1</strong><br>Adultos: a<br><strong>Quarto 2</strong><br>Adultos: b<br><strong>Quarto 3</strong><br>Adultos: c<br><strong>Quarto 1</strong><br>Adultos: a<br><strong>Quarto 2</strong><br>Adultos: b<br><strong>Quarto 3</strong><br>Adultos: c<br>