array() creates an array, with keys and values. If the key is omitted when specifying the array, an integer key is generated that starts at 0 and increments by 1. To create an associative array with array(), use => to separate the keys and values.
To create an empty array, do not pass parameters to
array():
$new = array();
Note: array()
is actually a language construct, usually It is used to define a direct array, but its usage is very similar to that of functions, so we also list it in the manual
PHP array() example
<span style="font-size: small;">array() 声明数组 <?php $a=array("a"=>"Dog","b"=>"Cat","c"=>"Horse"); print_r($a); ?> 输出: Array ( [a] => Dog [b] => Cat [c] => Horse ) </span>