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.
如果我有这样的功能:
function getTotal() { $total = array("gcBalance" => 5, "gcTotal" => 10); return $total; }
有没有一种方法可以调用函数并从gcBalance数组中取出值而不必循环?理想情况下,它会像这样工作,但事实并非如此。
gcBalance
$balance = getTotal()[0]; echo $balance;
echo $balance['gcBalance']应该这样做。
echo $balance['gcBalance']
$balance = getTotal(); echo $balance["gcBalance"];