For the moment I have been able to deal with this:
$link = "";
$longitud = strlen($pais);
for($i = 0; $i<$longitud;$i++){
if($pais[$i] == ""){
$link .= '+';
}else{
$link .= $pais[$i];
}
}
The result would be, for example, if $pais = "Estados Unidos de America"
variable $link = "Estados+Unidos+de+America"
My doubt is: there is some function to which you can indicate a delimiter and a character or string of characters to substitute this delimiter type explode()
but indicating a substitution character