Working with Arrays
- The default indexing mode in PHP, in terms of numerical indexing, starts at 0.
- A array can also be created by using the array() function.
- count(), sizeof() return the length of the array.
- The functions sort(), asort(), rsort(), ksort(), krsort() are used to sort array.
- The shuffle() function is used to arbitrarily distribute the elements of the array.
- The functions explode() and implode() are used to convert arrayto array and vice versa.
- The function array_diff( $sir1, $sir2, … ) identifies the elements that differ in the mentioned array.
- The array_sum() function sums the values that are elements of the array.
- Using the array_unique() function, identical elements of a array can be removed.
- The array_merge($nameSir1, $nameSir2) function allows you to merge two array into one.
- In PHP, a new array can be created as a substring of an already existing one, using the array_slice($Sirname, position, length) function.
Multidimensional arrays and functionality performed on arrays
- PHP supports arrays, respectively multidimensional arrays.
- To create a multidimensional array, the array members are also initialized to arrays.
- FIFO and LIFO are two different relationships to the data in the data collection, respectively two different types of data collections. FIFO – queue, LIFO – stack.
- PHP supports arrays of key-value pairs.
- Arrays can be managed by loops, functions or by direct access to indexes.