I have googled to no avail I am missing something so fundamental I can't see it.
I have the following array
$this->links = array (
0 =>
array (
'url' => 'http://maps.doc.govt.nz/Viewer/Index.html?viewer=rwa',
'text' => 'DOC maps: Discover the outdoors ',
),
1 =>
array (
'url' => 'https://booking.doc.govt.nz/',
'text' => ' ',
),
2 =>
array (
'url' => 'https://booking.doc.govt.nz/',
'text' => ' Book Great Walks, selected huts, campsites and more. ',
),
3 =>
array (
'url' => 'https://careers.doc.govt.nz/jobtools/jncustomsearch.searchResults?in_organid=18174&in_searchBut=Search',
'text' => 'Jobs at DOC ',
),
4 =>
array (
'url' => 'http://blog.doc.govt.nz/',
'text' => ' Conservation blog ',
)....
I am trying to loop through it with this
foreach ($this->links as $arrayId)
{
print "Link {\n";
foreach ($arrayId as $linktitle=>$linkdetail)
{
echo 'link: -'.$linktitle .'<br/> bit'.$linkdetail;
}
}
But I am getting a Warning: Invalid argument supplied for foreach() error. I really don't know why its not working, I have also tried every variation I can think of?? Still getting the same error?
UPDATE I dump the variable and $links is described as an array however when I add an is_array condition it returns false??????
var_dump($links);
- string 'array (
0 =>
array (
'url' => 'http://www.iana.org/domains/example',
'text' => 'More information... ',
if (is_array($links))
{
echo "Its an array";
} - does not return
$thisis refer to object or class, where it is ?$linksisstringnotarray