This array is being populated with URL's using a for each loop (they are page number URL's)
$pageNumberLinks[] = "<a href= URL_code>".$page_number . "</a>";
I am trying to reference the $page_number variable value in each URL in the array as the foreach loop executes, so I can use an if statement to execute code based on the $page_number value. $PageNumberLinks->page_number is not working. Any advice?
foreach ($pageNumberLinks as $PageNumberLinks) {
if ($PageNumberLinks->page_number == $z ) {
// execute code
} else {
// execute code
}
}
$pageNumberLinks[$page_number] = "<a href= URL_code>".$page_number . "</a>";? This way, you will be able to loop through the indexes properly.$page_numbervariable isn't accessible in the way your are using it. The->is attempting to access an object property. Unless$PageNumberLinksis an object, then it won't work.