Check out example codes for "php loop troug array". It will help you in understanding the concepts better.

Code Example 1

$clothes = array("hat","shoe","shirt");
foreach ($clothes as $item) {
	echo $item;
}

Code Example 2

foreach (array as $value){ 
  //code to be executed; 
  print("value : $value");
} 

foreach (array as  $key => $value){ 
  //code to be executed; 
  print("key[$key] => $value");
}

Code Example 3

<?php
$salary[]=2000;
$salary[]=3000;
$salary[]=5000;

foreach($salary as $value){
  echo "Salary: $value<br>";
}
?>

Learn ReactJs, React Native from akashmittal.com