Indexed Array in PHP – website development

In this video

This tutorial is about Indexed Array in PHP. In our last lecture we learned about Find Random Element from Array in PHP. If you haven’t watched it yet then here is the link of tutorial

Indexed Array in PHP

In this tutorial we will learn about Indexed Array in PHP. An array is a data structure that stores one or more similar type of values in a single value, so for example if you want to store 100 numbers then instead of defining 100 variables its easy to define an array of 100 length.

Numeric array/Indexed array

An array with a numeric index. Values are stored and accessed in linear fashion.

Array function

In PHP, the array() function is used to create an array:


Create Indexed Array

There are two ways to create indexed arrays:

The index can be assigned automatically (index always starts at 0), like this:

$c = array(“Volvo”, “BMW”);

or the index can be assigned manually:

$c[0] = “Volvo”;

$c[1] = “BMW”;

so these are two ways to create indexes array , so code for first method is here.


$cars = array(“Volvo”, “BMW”, “Toyota”);

echo “I like ” . $cars[0] . “, ” . $cars[1] . ” and ” . $cars[2] . “.”;


Output: I like Volvo, BMW and Toyota.

Indexed Array in PHP tutorial end here, so then next we will learn about Associative Array in PHP. If you have any queries you can ask us on our Facebook page link is given below, Thank you for watching us.


Tutorial Hive’s mission is to provide quality education to all our community. Tutorial Hive’s mission is to provide free education to all those who cannot afford BIG FEE of institutes. We aim specifically to empower youth to understand programming related knowledge which further helps the society to reduce complex problems through applications. Why Tutorial Hive? We not only provide the theoretical knowledge but also provide the actual implementation with working sample applications. Tutorial Hive cannot achieve its mission without the help of our community. So, please if you think you can help in any manner feel free to contact us. Or if you see any mistake in our content which can be modified/corrected then please leave us a message

We are always open for suggestions.


Subscribe on YouTube:


Follow us on Social Media

You might be interested in


Your email address will not be published. Required fields are marked *