Advertisement

Google Ad Slot: content-top

PHP Arrays


Arrays are powerful data structures that allow you to store and manage collections of data. They are flexible and can hold various data types, including strings, integers, objects, and even other arrays.


Types of Arrays in PHP


PHP supports three main types of arrays:


  1. Indexed Arrays
  2. Associative Arrays
  3. Multidimensional Arrays




Example
<?php
$fruits = ["Apple", "Banana", "Cherry"];
echo $fruits[0]."<br>"; // Outputs: Apple
echo $fruits[1]; // Outputs: Banana
?>
Try it yourself