When I run the following code, I get exactly that output that I need.
$array_items = count($links);
for ($i = 0; $i <= $array_items; $i++) {
echo $links[$i]->title;
}
However, I get 2 notices:
Notice: Undefined offset: 2 in C:\xampp\htdocs...
Notice: Trying to get property of non-object in C:\xampp\htdocs...
I guess that's because $links
returns an array and inside that array there is an object.
How can I fix it?