Skip to content

Instantly share code, notes, and snippets.

@YurePereira
Created May 24, 2017 04:00
Show Gist options
  • Select an option

  • Save YurePereira/cddd46437c96f6fc2a89e7e4a72b2dcd to your computer and use it in GitHub Desktop.

Select an option

Save YurePereira/cddd46437c96f6fc2a89e7e4a72b2dcd to your computer and use it in GitHub Desktop.
Usando o laço de repetição FOREACH.
<?php
//Primeira sintaxe:
foreach ($array as $value) {
echo 'Valor: ' . $value . PHP_EOL;
}
//Segunda sintaxe:
foreach ($array as $key => $value) {
echo 'Chave: ' . $key . ', Valor: ' . $value . PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment