Answers for "loop through an array in php"

PHP
1

php loop through array

$letters = ['a','b','c'];
foreach ($letters as $item) {
  echo $item;
}
Posted by: Guest on October-01-2020
5

foreach in php

$arr = array(
	'key1' => 'val',
	'key2' => 'another',
	'another' => 'more stuff' 
);
foreach ($arr as $key => $val){
	//do stuff
}

//or alt syntax
foreach ($arr as $key => $val) :
   //do stuff here as well
endforeach;
Posted by: Guest on May-15-2020
1

php array loop

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

    // to know what's in $item
    echo '<pre>'; var_dump($item);
}
Posted by: Guest on May-05-2020

Code answers related to "loop through an array in php"

Browse Popular Code Answers by Language