Skip to content

Instantly share code, notes, and snippets.

@YurePereira
Last active May 24, 2017 04:50
Show Gist options
  • Select an option

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

Select an option

Save YurePereira/4154a640ba8c85dc23e0d34494ca388f to your computer and use it in GitHub Desktop.
Usando o laço de repetição FOR, percorrendo um array 2.
<?php
//Array de elemento
$myArray = array(0, 1, 2, 3, 4);
//Iterando item por item do Array $myArray
for ($i = 0, $length = count($myArray); $i < $length; $i++) {
echo 'Item índice: ' . $i . ', Valor: ' . $myArray[$i] . PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment