PHP错误的地方来自echo [关闭]

can be deleted "323 2 32 3 23wwerwrwre

Since send() does its own echoing, you shouldn't call it in the echo statement. You should do:

echo "Groups: ";
send();

Remember that the arguments to a function or operator have to be evaluated before the function/operator can be invoked. If evaluating the argument has side effects, such as printing output, that will take place before the function/operator is called. So your code is roughly equivalent to:

$temp = send();
echo "Groups: " . $temp;

Written this way, it should be obvious why the list is printed before Groups:.

If you want to call the function your way, it needs to return the string rather than echoing it itself.

public function send() {
    global $t;
    $result = "";
    foreach ($t->serverGroupList() AS $r) {
        $result .= $r;
    }
    return $result;
}

or more simply:

public function send() {
    global $t;
    return implode("", $t->serverGroupList());
}