php loop through array
snippet in php

php loop through array

user5007

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

php loop troug array

user4004

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

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

php loop through array

user6370

$letters = ['a','b','c'];
foreach ($letters as $item) {
  echo $item;
}

php loop through array

user3152

foreach($array as $item=>$values){
     echo $values->filepath;
    }

php loop through array

user8681

foreach($array as $item) {
    echo $item['filename'];
    echo $item['filepath'];

    // to know what's in $item
    echo '<pre>'; var_dump($item);
}

php loop through array

user5629

foreach (array_expression as $value)
    statement
foreach (array_expression as $key => $value)
    statement