How could I add blank spaces to a string? [closed]

0

link

What I try is to remove this parameter from the URL "/ Sports% 20-% 20Arte" and then make a selection in the BD

$busqueda = str_replace('%20'," ",$busqueda);

but until now I only keep this: Sports-Art and I want to achieve something like this: Sports - Art

    
asked by Julio Vasquez 06.07.2017 в 05:44
source

1 answer

3

In addition to your example that works correctly and considering that you are using URLs you can use urldecode

string urldecode ( string $str )
  

Decode any cipher type% ## in the given string. The symbols   ('+') are decoded as the space character.

echo urldecode ('http://localhost/mercadito/categoria/index/Deportes%20-%20Arte');

Print the space you need

http://localhost/mercadito/categoria/index/Deportes - Arte
    
answered by 06.07.2017 в 06:10