如何确定数组的条目数量?

Chr*_*ris 1 php arrays

我正试图向后循环一个数组,所以我想我可以试试

$Array = Array("One", "Two", "Three", "Four", "Five");
For ($Entry = Amount_of_values($Array); $Entry = 0; $Entry = $Entry-1){
    Echo $Array[$Entry] . " "; //Should be Five Four Three Two One
}
Run Code Online (Sandbox Code Playgroud)

但我不知道如何检索数组中的值(Amount_of_values($ Array)).我正在寻找什么功能?

提前致谢!

编辑:附加一点问题:为什么在for循环中$ Entry> = 0,是不是我要输出$ Array [0]的最后一件事?

Dom*_*ger 5

有一种更好的方式来完成您的代码片段-使用 implodeand array_reverse

$Array = Array("One", "Two", "Three", "Four", "Five");
echo implode(" ", array_reverse($Array)); // Should be Five Four Three Two One
Run Code Online (Sandbox Code Playgroud)

实际问题的答案是,如果要计算数组中的条目数,则需要count