PHP str_replace %20

When you code php upload file. I find solution from google it's so many many and many. I copy it to test script below
$text = "Khon Kaen SOFT";
$text1 = str_replace(' ', '+', $text);
$text2 = str_replace(' ', "+", $text);
$text3 = str_replace("", "+", $text);
$text4 = str_replace(" ", "+", $text);
$text5 = str_replace('%20', "+", $text);
$text6 = str_replace('', '+', $text);
$text7 = str_replace('', "+", $text); 
echo "1=$text1 <br>2=$text2 <br>3=$text3<br>4=$text4<br>5=$text5<br>6=$text6<br>7=$text7";
Output
1=Khon+Kaen+SOFT
2=Khon+Kaen+SOFT
3=Khon Kaen SOFT
4=Khon+Kaen+SOFT
5=Khon Kaen SOFT
6=Khon Kaen SOFT
7=Khon Kaen SOFT

Comments