foreach 1 to 5 php code example
Example 1: php array loop
for ($i = 0; $i < count($array); $i++) {
echo $array[$i]['filename'];
echo $array[$i]['filepath'];
}
Example 2: php foreach
$arr = ['Item 1', 'Item 2', 'Item 3'];
foreach ($arr as $item) {
var_dump($item);
}
Example 3: php array loop
foreach($array as $item) {
echo $item['filename'];
echo $item['filepath'];
// to know what's in $item
echo '<pre>'; var_dump($item);
}