array

  • How arrays are defined
    • Format 1: array(value 1, value 2, value 3);
      • Array without specifying a subscript, the subscript is a continuously increasing value
    • Format 2: array(key=>value, key=>value);
      • Specify the subscript, the subscript is the value specified by the user (string, value)
  • Declare the array using the specified syntax php version > 5.3
    • Format 1: array variable = [value1, value2];
      • Do not specify a subscript, declare an indexed array
    • Format 2: array variable=[key=>value, key=>value];
      • Specify the subscript, the subscript is the value specified by the user
  • Declare an array by adding array elements directly
    • Format 1: array variable[]=value
      • The subscript of the array declared in this way is a continuous index array starting from 0
    • Format 2: array variable [subscript] = value;
      • Declare arrays by adding elements, either associative arrays or indexed arrays

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324777750&siteId=291194637