我有一个多维数组($array),其中的条目如下:
{ ["upload/example.gif"]=> array(5) {
["title"]=> string(12) "This is me"
["excerpt"]=> string(24) "This is a photo of a tree"
["img"]=> string(42) "upload/example.gif"
["link"
我需要从多维数组中获取最后6个值,我正在尝试这样做
for($i=0;$i<6;$i++){
$stats = array_shift($stats);
}
但是在第一次array_shift之后,我得到了以下错误
PHP Warning: array_shift(): The argument should be an array
在PHP中有没有可以做到这一点的函数?
由于服务器的版本,我试图将PHP多维数组转换为javascript数组,而不使用json编码器。
多维数组的例子:
Array (
[0] => Array (
[0] => 18
[1] => Région Grand EST
[2] => GE )
[1] => Array (
[0] => 17
[1] => Région Grand OUEST / NORD
[2] => GO N