Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Array and Its Type in PHP.

An array is a collection of data items stored under a single name. Array provides a mechanism for declaring and accessing several data items with only one identifier, thereby simplifying the task of data management.

we use an array when we have to deal with multiple data items.

There are three types of array.

1. Numeric/Indexed array.

2. Associative array.

3. Multidimensional Array.

Numeric/Indexed array

When an array index is represented by a number, it is called Numeric/Indexed array. By default, numeric array index starts from 0.

Syntax:- $array_name [0] = Value;

For Example:- $name[0]= “Sushant”;

Sample program

<?php
$name [0]= “Sushant”;
echo $name[0];
?>

Output:- Sushant

Associative array.

When an array index is represented by a String, it is called Associative array.

For Example:- $Fee [“Sushant”] = 520;

Multidimensional Array.

Arrays of Arrays is known as Multidimensional Array.

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.