I've been charged with migrating quite an old site to a new server, which also means upgrading (late, I know) to PHP 5.
Most of it went quite smoothly but there's one error that I can't understand.
The site is used for an online language course and now all the text in the exercises is shown twice. Can anyone see what's wrong with this function (which is used for retrieving the text)?
function getBlankWithEndFormatedExerciseText($type, $highLightNr = 0) {
$lastWhereEndOfLine = true;
foreach ($this->children AS $sentence) {
if ($sentence->order == $highLightNr) {
$returnString .= "<SPAN class=\"highLightedExerciseSentence\">";
}
$sentence->selectWordDbInstances();
foreach ($sentence->words AS $word) {
if ($lastWhereEndOfLine) {
if ($word->indent) {
for ($i=0; $i < $word->indent; $i++) {
$returnString .= " ";
}
}
$lastWhereEndOfLine = false;
}
if ($word->wordBase != "" && $word->wordEnd != "") {
$returnString .= $word->wordBase . "-";
} else {
$returnString .= $word->word;
}
if ($word->followedByPunctuation) {
$returnString .= $word->followedByPunctuation;
}
if ($word->endOfLine) {
$returnString .= "<BR>";
$lastWhereEndOfLine = true;
} else {
$returnString .= " ";
}
}
if ($sentence->order == $highLightNr) {
$returnString .= "</SPAN>";
}
}
return $returnString;
}
I do realize this is quite complex and refers to other functions and so on but any help would be much appreciated.
The function is called with this:
echo("<DIV>" . $exercise->getBlankWithEndFormatedExerciseText($exercise->exerciseType, 0) . "</DIV><HR>");