How to return string that extended by recursive loop in a php function?

Thread continues here: How to stop php recursive loop when return value?