php for x of loop code example
Example 1: for php
<?php
$fruits = ["apple", "banana", "orange"];
for($i=0;$i<count($fruits);$i++){
echo "Index of ".$i."= ".$fruits[$i]."<br>";
}
?>
Example 2: php loop through array
foreach($array as $item) {
echo $item['filename'];
echo $item['filepath'];
// to know what's in $item
echo '<pre>'; var_dump($item);
}