+ 1

How can I use an array with a for loop?

I want to get a database results in array; Ex: $nameEmployee=array( $show_name['namEmployee'], $show_name['firstnameEmployee']);

17th Jun 2019, 7:30 PM
John Ntambwe
John Ntambwe - avatar
2 Answers
+ 1
If you want to iterate through an array, you can use the for or foreach loop: for ($i = 0; $i < {arrlength}; $i++) { //code, use arr[$i] to access nth element; } foreach(arr as $i) { //code, use $i to access nth element }
17th Jun 2019, 8:47 PM
Airree
Airree - avatar
+ 1
Great, thank you very much
17th Jun 2019, 8:51 PM
John Ntambwe
John Ntambwe - avatar