fork download
  1. <?php
  2.  
  3. $names = ['Robert', 'Adam', 'Magda'];
  4. foreach ($names as $name) { // pobiera kolejne elementy tabel
  5. echo $name . "<br />";
  6. }
  7. foreach ($names as $key => $name) { // inna forma: klucz => wartość
  8. echo $key . " -> " . $name . "<br /> ";
  9. }
Success #stdin #stdout 0.02s 24320KB
stdin
Standard input is empty
stdout
Robert<br />Adam<br />Magda<br />0 -> Robert<br /> 1 -> Adam<br /> 2 -> Magda<br />