replace($code, $langcode, $unknown_character); // Check if this exceeds the maximum allowed length. if (isset($max_length)) { $length += 1; if ($length > $max_length) { return $result; } } $result .= $to_add[0]; } } return $result; } }