Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个数组:
array(2) { [0]=> string(6) "Coffee" [1]=> string(4) "best" }
我怎样才能像咖啡一样从中获得价值,最好的?
您可以使用它们的索引访问数组。PHP 中的数组索引从 0 开始并向上计数。
$myArray = array("Coffee","best"); $coffee = $myArray[0]; $best = $myArray[1];
这是声明数组的更困难的方法
<?php array(2) { [0]=> string(6) "Coffee" [1]=> string(4) "best" } $arrayname['Key']; //access ?>