TYPES OF ARRAY IN PHP

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now
PHP - Wikipedia

ARRAY :- Array is a variable, which can hold more than one value OR diffrent types of data types at a time in a single variable.

ex- $data= array( “bikash”, 100,500,”rahul”);

There are three types of array in PHP

  1. Indexed array : array with a numeric keys.
  2. Associative arrays : Arrays with named keys
  3. Multidimensional arrays : Arrays containing one or more arrays
  1. NUMERIC array:- Numeric Array is a type of array with numeric indices to access its values. However, they can store numbers, characters, strings, etc. By default, the array indices are represented by numbers if not specified, and it starts with index 0 and ends with index -1
php tutorial - PHP Indexed Arrays - php programming - learn php - php code  - php script - wikitechy

2. Associative arrays :-

Associative array differ from numeric array in the sense that associative arrays use diffrents names for id keys. And the key and value is saparated by “=>”.

Below ithe syntax for creating associative array in php

PHP Array: Associative, Multidimensional