fork(1) download
  1. <?php
  2.  
  3.  
  4. $i = 0;
  5. $j = 0;
  6. $enderecos = array(array('cep' => '00000-00', 'rua' => 'Rua XXXX'), array('cep' => '11111-111', 'rua' => 'Rua YYYY'));
  7.  
  8. foreach ($enderecos as $endereco) {
  9. ?>
  10. <input type="text" name="endereco[<?php echo $i?>][cep]" value="<?php echo $endereco['cep']; ?>" tabindex="<?php echo ($j+1) ?>">
  11. <input type="text" name="endereco[<?php echo $i?>][rua]" value="<?php echo $endereco['rua']; ?>" tabindex="<?php echo ($j+2) ?>">
  12. <?php
  13. $i++;
  14. $j+=2;
  15. }
  16. ?>
Success #stdin #stdout 0.01s 82880KB
stdin
Standard input is empty
stdout
    <input type="text" name="endereco[0][cep]" value="00000-00" tabindex="1">
    <input type="text" name="endereco[0][rua]" value="Rua XXXX" tabindex="2">
    <input type="text" name="endereco[1][cep]" value="11111-111" tabindex="3">
    <input type="text" name="endereco[1][rua]" value="Rua YYYY" tabindex="4">