php - Function executing twice -
i've been charged migrating quite old site new server, means upgrading (late, know) php 5.
most of went quite smoothly there's 1 error can't understand.
the site used online language course , text in exercises shown twice. can see what's wrong function (which used retrieving text)?
function getblankwithendformatedexercisetext($type, $highlightnr = 0) { $lastwhereendofline = true; foreach ($this->children $sentence) { if ($sentence->order == $highlightnr) { $returnstring .= "<span class=\"highlightedexercisesentence\">"; } $sentence->selectworddbinstances(); foreach ($sentence->words $word) { if ($lastwhereendofline) { if ($word->indent) { ($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 realize quite complex , refers other functions , on appreciated.
the function called this:
echo("<div>" . $exercise->getblankwithendformatedexercisetext($exercise->exercisetype, 0) . "</div><hr>");
Comments
Post a Comment