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 .= "&nbsp;&nbsp;&nbsp;";                           }                    }                 $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

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -