Course Content
Introduction
PHP is an object-oriented scripting programming language that allows web developers to create dynamic and interactive web pages. PHP stands for Hypertext Preprocessor (PHP).
0/14
Control Statement
A control statement is a statement that determines whether other statements will be executed.
0/7
    About Lesson

    The foreach loop is used to traverse the array elements. The foreach loop works only on arrays and is used to loop through each key/value pair in an array.

     

    Syntax:

    foreach ($array as $value) {
      	code to be executed;
    }

     

    Example:

    $colors = array("red", "green", "blue", "yellow", “orange”);
    foreach ($colors as $value) {
      echo "$value <br>";
    }