* numeric array */$row = $result->fetch_array(MYSQLI_NUM);printf ("%s (%s)\n", $row[0], $row[1]);/* associative
Whenoperatorshaveequalprecedencetheirassociativitydecideshowtheoperatorsaregrouped.Forexample"-"isleft-associative
output as object: ", json_encode($b, JSON_FORCE_OBJECT), "\n\n";$c = array(array(1,2,3));echo "Non-associative
localtime (PHP4,PHP5,PHP7) localtime-获取当地时间 描述 arraylocaltime([int$timestamp=time()[,bool$is_associative
php$file = new SplFileObject("/etc/passwd");$stat = $file->fstat();// Print only the associative partprint_r
CountryCode FROM City ORDER by ID DESC LIMIT 50,5";if ($result = $mysqli->query($query)) { /* fetch associative
', 'fruit3' => 'grape', 'fruit4' => 'apple', 'fruit5' => 'apple');// this cycle echoes all associative
passwd", "r");// gather statistics$fstat = fstat($fp);// close the filefclose($fp);// print only the associative
CountryCode FROM City ORDER by ID DESC LIMIT 50,5";if ($result = mysqli_query($link, $query)) { /* fetch associative
想知道一个数组是索引数组还是联合数组很方便,这有个例子: //不指定键名的数组$indexed=['Qiang','Paul'];echoArrayHelper::isIndexed($indexed);//所有键名都是字符串$associative
(about:blank#try-it) -[UsingAssociativeArraysInaRequestParameter](about:blank#using-associative-arrays-in-a-request-parameter
功能 Usage:(associative?