How to use arrays in php?

In PHP, an array is a data structure that allows you to store multiple values under a single variable name.

Example:

  $colors = array('red', 'green', 'blue');
  
Solution:

  echo $colors[1];  // Outputs: green
  

Beginner's Guide to PHP