1$clothes = array("hat","shoe","shirt");
2foreach ($clothes as $item) {
3 echo $item;
4}
1for ($i = 0; $i < count($array); $i++) {
2 echo $array[$i]['filename'];
3 echo $array[$i]['filepath'];
4}
1$arr = ['Item 1', 'Item 2', 'Item 3'];
2
3foreach ($arr as $item) {
4 var_dump($item);
5}
1foreach($array as $i => $item) {
2 echo $item[$i]['filename'];
3 echo $item[$i]['filepath'];
4
5 // $array[$i] is same as $item
6}
1foreach($array as $item) {
2 echo $item['filename'];
3 echo $item['filepath'];
4
5 // to know what's in $item
6 echo '<pre>'; var_dump($item);
7}