diff --git a/client/src/pages/guide/english/php/php-array/index.md b/client/src/pages/guide/english/php/php-array/index.md index cc956765d30..9fce56d32ae 100644 --- a/client/src/pages/guide/english/php/php-array/index.md +++ b/client/src/pages/guide/english/php/php-array/index.md @@ -2,39 +2,39 @@ title: Php Arrays --- -An array is a data structure that stores one or more similar type of values in a single value. For example if you want to store 100 numbers then instead of defining 100 variables its easy to define an array of 100 length. +An array is a data structure that stores one or more similar type of values in a single value. For example, if you want to store 100 numbers then instead of defining 100 variables it's easier to define an array of length 100. -There are three different kind of arrays and each array value is accessed using an ID c which is called array index. +There are three different kind of arrays and each array value is accessed using an ID which is called array index. -Numeric array − An array with a numeric index. Values are stored and accessed in linear fashion. +Indexed array − An array with a numeric index. Values are stored and accessed in a linear fashion. -Associative array − An array with strings as index. This stores element values in association with key values rather than in a strict linear index order. +Associative array − An array with strings as the index. This stores element values in association with key values rather than in a strict linear index order. -Multidimensional array − An array containing one or more arrays and values are accessed using multiple indices +Multidimensional array − An array containing one or more arrays and values are accessed using multiple indices. -NOTE − Built-in array functions is given in function reference PHP Array Functions +NOTE − Built-in array functions are given in the function reference PHP Array Functions section. -### Numeric Array +### Indexed Arrays These arrays can store numbers, strings and any object but their index will be represented by numbers. By default array index starts from zero. #### Example -Following is the example showing how to create and access numeric arrays. +Following is the example showing how to create and access indexed arrays. -Here we have used array() function to create array. This function is explained in function reference. +Here we have used array() function to create an array. This function is explained in function reference. ```
"; } - /* Second method to create array. */ + /* Second method to create an array. */ $numbers[0] = "one"; $numbers[1] = "two"; $numbers[2] = "three"; @@ -66,33 +66,34 @@ Value is five ``` ### Associative Arrays -The associative arrays are very similar to numeric arrays in term of functionality but they are different in terms of their index. Associative array will have their index as string so that you can establish a strong association between key and values. +The associative arrays are very similar to Indexed arrays in term of functionality but they are different in terms of their index. The elements in an associative array have their indices as strings so that you can establish a strong association between the keys and values. -To store the salaries of employees in an array, a numerically indexed array would not be the best choice. Instead, we could use the employees names as the keys in our associative array, and the value would be their respective salary. +To store the salaries of employees in an array, a numerically indexed array would not be the best choice. Instead, we can use the employee's names as the keys in our associative array, and the value will be their respective salaries. -NOTE − Don't keep associative array inside double quote while printing otherwise it would not return any value. +NOTE − Don't keep an associative array inside double quotes while printing otherwise it will not return any value. + +#### Example ``` -Example 2000, "qadir" => 1000, "zara" => 500); - echo "Salary of mohammad is ". $salaries['mohammad'] . "