Indexed array

PHP indexed array is a simple type of array.
An indexed array use number as access keys.
You can define indexed array in following two ways:

OR

Example

Output:

Output:

Here, $country is a name of variable.
0,1,2 are the index numbers of the elements.
India, Australia, Switzerland are the values assigned to array elements.

Ankit Wasankar

Senior Java Developer
Java 11 | Microservices | Reactjs | SQL

Help others by sharing the content!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.