Lose the curly brackets:
Code:
if ({$quotations [$bigIndex + 1]} != $noAuthor) {
echo "- {$quotations [$bigIndex + 1]}";
}
They're not valid there. Do it like so:
Code:
if ($quotations [$bigIndex + 1] != $noAuthor) {
echo "- {$quotations [$bigIndex + 1]}";
}
I don't pretend to know that much about PHP. But it's my understanding that the use of curly brackets in the line where they are OK:
Code:
echo "- {$quotations [$bigIndex + 1]}";
Means roughly that, because this is a string delimited with double quotes and it might be unclear where the variables are, please resolve the data inside the curly brackets as a variable value first.
In the line where they don't work, there are no delimiting double quotes. You could do it like so:
Code:
if ("{$quotations [$bigIndex + 1]}" != "$noAuthor") {
echo "- {$quotations [$bigIndex + 1]}";
}
It's just extra typing though.
BTW, there's a typo in quotations.txt (line #612):
"Most writers regard the truth as their most valuable
ossession, and therefore are most economical in its use.",
Should be possession.
Bookmarks