Home »
MCQs »
PHP MCQs
Which loop statement is used to loop through a block of code for each element in an array?
94. Which loop statement is used to loop through a block of code for each element in an array?
- while
- do...while
- for
- foreach
Answer: D) foreach
Explanation:
In PHP, the foreach loop statement is used to loop through a block of code for each element in an array.