Php 函数执行两次

Php 函数执行两次,php,function,Php,Function,我负责将一个相当旧的站点迁移到一个新的服务器,这也意味着升级(我知道很晚)到PHP5 大部分过程都很顺利,但有一个错误我不明白 该网站用于在线语言课程,现在练习中的所有文本显示两次。有人能看到这个函数(用于检索文本)有什么问题吗 函数GetBlankWithEndFormattedExerciseText($type,$highLightNr=0){ $lastwerendofline=true; foreach($this->children AS$句子){ 如果($句子->顺序==$high

我负责将一个相当旧的站点迁移到一个新的服务器,这也意味着升级(我知道很晚)到PHP5

大部分过程都很顺利,但有一个错误我不明白

该网站用于在线语言课程,现在练习中的所有文本显示两次。有人能看到这个函数(用于检索文本)有什么问题吗

函数GetBlankWithEndFormattedExerciseText($type,$highLightNr=0){ $lastwerendofline=true; foreach($this->children AS$句子){ 如果($句子->顺序==$highLightNr){ $returnString.=“”; } $SENTRANCE->selectWordDbInstances(); foreach($句子->单词作为$word){ 如果($lastWhereEndOfLine){ if($word->indent){ 对于($i=0;$i<$word->indent;$i++){ $returnString.=“”; } } $LASTWHERENDOFLINE=假; } 如果($word->wordBase!=“”&&&$word->wordEnd!=“”){ $returnString.=$word->wordBase.“-”; }否则{ $returnString.=$word->word; } if($word->followerbypuncuation){ $returnString.=$word->followerdbypuntuation; } 如果($word->endOfLine){ $returnString.=“
”; $lastwerendofline=true; }否则{ $returnString.=“”; } } 如果($句子->顺序==$highLightNr){ $returnString.=“”; } } return$returnString; } 我知道这是相当复杂的,并涉及到其他功能等,但任何帮助将不胜感激

使用以下命令调用该函数:

    echo("<DIV>" . $exercise->getBlankWithEndFormatedExerciseText($exercise->exerciseType, 0) . "</DIV><HR>");
echo(“$exercise->getBlankWithEndFormatedExerciseText($exercise->exerciseType,0)。”
”;
什么是$this->children?在函数的开头放一个断点,或者添加一个断点,看看为什么会执行两次。如果您在问题中向函数添加调用,那么会更符合逻辑。。。如果它运行了两次,并且它本身没有调用,那么就更有可能找到错误…显示如何调用函数。
    echo("<DIV>" . $exercise->getBlankWithEndFormatedExerciseText($exercise->exerciseType, 0) . "</DIV><HR>");