php array for loop code example
Example 1: php array loop
foreach($array as $i => $item) {
echo $item[$i]['filename'];
echo $item[$i]['filepath'];
}
Example 2: php for loop
for($i = 0; $i <=10; $i++){
echo "The index is $i";
}
Example 3: loop through php array
foreach (array_expression as $value)
statement
foreach (array_expression as $key => $value)
statement
Example 4: php loop through array
foreach($array as $item) {
echo $item['filename'];
echo $item['filepath'];
echo '<pre>'; var_dump($item);
}