php foreach
snippet in php

php loop through array

user1631

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

php foreach

user5441

$arr = ['Item 1', 'Item 2', 'Item 3'];

foreach ($arr as $item) {
  var_dump($item);
}

php foreach

user5530

<?php
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");

foreach($age as $x => $val) {
  echo "$x = $val<br>";
}
?>

php foreach

user304

$arr = ['Item 1', 'Item 2', 'Item 3'];

foreach ($arr as $item) {
  var_dump($item);
}

php foreach

user5704

<?php
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");

foreach($age as $x => $val) {
  echo "$x = $val<br>";
}
?>

php foreach

user7260

<?php
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");

foreach($age as $x => $val) {
  echo "$x = $val<br>";
}
?>