Using php's `foreach` loop?

The `foreach` loop in PHP is used to iterate over arrays. It provides an easy way to access each key/value pair.


  $arr = array('a', 'b', 'c');
  foreach ($arr as $value) {
      echo $value;
  }
  

This will output:


  a
  b
  c
  

Beginner's Guide to PHP