PHP Array Explanation

Array is one of the most important and basic terms in PHP Language. Almost all standard PHP programs use array data structure. So, those who want to be expert in PHP programming should have good understanding on PHP array. In my last article, I explained some PHP basic fundamentals like PHP variables, PHP conditional statements, PHP looping statements and PHP function. In this article I will explain PHP array data structure with example.   PHP Array PHP array is a special variable that can hold one or more value at a time in a single variable. Multiple values from an array are retrieved with array indexes. For example, the following PHP array contains five numeric values in a single variable. $numbers = array(10, 20, 30,40,50); These array values are retrieved using array indexes. Array index is by default start with 0 and increase by one if we do not define array index explicitly. How to declare PHP array properly and how to retrieve array elements will be discussed elaborately in the following sections. How to Declare PHP Array PHP has a built-in function named array() which is used to create array data. The basic structure of declaring a PHP array is: $a […]

Continue reading