Category: 04. Arrays

  • Constant Arrays

    It was not possible to declare a constant array before PHP version 5.6. From PHP 5.6 onwards, you can use the “const” keyword to declare a constant array. From PHP 7 onwards, constant arrays can also be formed with define() function. A constant array is an array which cannot be modified after it has been…

  • Array Functions

    PHP Array Functions allow you to interact with and manipulate arrays in various ways. PHP arrays are essential for storing, managing, and operating on sets of variables. PHP supports simple and multi-dimensional arrays and may be either user created or created by another function. Installation There is no installation needed to use PHP array functions; they…

  • Multidimensional Array

    A multidimensional array is an array of arrays. In a PHP array, each element can be another array. If the array consists of values or key-value pairs with values being of singular scalar types, it is a one-dimensional array. If each element in an array is an array of one or more scalar values, it…

  • Associative Array

    If each element in a PHP array is a key-value pair, such an array is called an associative array. In this type of array, each value is identified by its associated key and not an index. How to Declare an Associative Array in PHP? Both the approaches of declaring an array – the array() function and…

  • Indexed Array

    In PHP, the array elements may be a collection of key-value pairs or it may contain values only. If the array consists of values only, it is said to be an indexed array, as each element is identified by an incrementing index, starting with “0”. An indexed array in PHP may be created either by…

  • Arrays

    An array is a data structure that stores one or more data values having some relation among them, in a single variable. For example, if you want to store the marks of 10 students in a class, then instead of defining 10 different variables, it’s easy to define an array of 10 length. Arrays in…