从这个php函数获取整数,显示正在查看的元素数量?

I got this function:

<?php bbp_get_topic_pagination_count(); ?>

and the final output is something like this:

Viewing 10 replies - 1 through 10 (of 13 total)

I would like to just get (filter) the "total" (13 in the example above).

Any suggestions?

Something like this?

function custom_function() {
    global $bbp;
    return bbp_number_format( $bbp->reply_query->found_posts );
}

It looks like this number is fetched from $bbp->reply_query->found_posts. Just use that expression. (Make sure to issue global $bbp; if you are going to fetch the value from inside a function.)

Well just a wild guess but given that $bbp is a global, and assuming that it isn't altered in any detrimental way as a side effect of executing that function, you should be able to copy exactly what is assigned to $total in the function, i.e. you can get the value like this:

$total = $bbp->reply_query->found_posts;
function custom_bbp_get_total() {
    global $bbp;
    $total = bbp_number_format( $bbp->reply_query->found_posts );
    return $total;
}