I'm not sure but global $r_opt; could be problem, why it is global, you'r already returning a value? Also you could use " ' " in html tags. I want to post a clean version of your code: <?php function frelatededit($related){ global $r_opt; $lenght = strlen($related); $prefex = substr($relat...