I'm fairly new to php and I'm having trouble understanding why this piece of code doesn't work:
foreach ($titles as $values) {
echo '<a href="index.php">' . $values . '</a>';
}
I'm fairly new to php and I'm having trouble understanding why this piece of code doesn't work:
foreach ($titles as $values) {
echo '<a href="index.php">' . $values . '</a>';
}
$titles=array('title1','title2','title3');
if (is_array($titles)){
foreach ($titles as $values) {
echo '<a href="index.php">' . $values . '</a>';
}
}
Please check if your $titles is an array first with is_array().