If the function returns the value via a return() statement:
$str = 'this is my '.myFunction($val1, $val2).' in my string';
If the function echoes/prints the value you want:
ob_start();
myFunction($val1, $val2);
$text = ob_get_flush();
$str = 'this is my '.$text.' in my string';
Obviously the first method is cleaner and probably quicker, so would suggest using that if possible.