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?

  1. while
  2. do...while
  3. for
  4. 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.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.