我有以下 PHP 代码:
foreach ($resources as $resource)
{
// Iterates on the found IDs
//echo 'Name of field: ' . $resource . ' - Value: ' . $resource->attributes() . '<br />';
echo '<tr><td>'.$resource->attributes().'</td></tr>';
}
Run Code Online (Sandbox Code Playgroud)
返回:
1
2
3
4
5
6
7
8
Run Code Online (Sandbox Code Playgroud)
我只想获取最后一项的值:8 我尝试使用:
echo end(end($resources->attributes()));
Run Code Online (Sandbox Code Playgroud)
但这返回:1
关于如何获得8值有什么想法吗?
谢谢
| 归档时间: |
|
| 查看次数: |
5847 次 |
| 最近记录: |