Url problems in managing the spaces

Hi guys new problem,

I want to pass a variable by get so far so good except when the variable has a space inside.

Ie ‘car’ is fine

‘blue car’ not good

Because he default I put the + between the two words, I tried to use str_replace ("", “% 20”, $ variable) in php but adds a %2520 that I can not understand or ‘blu%2520car’.

there a solution to this problem?