mardi 19 janvier 2021

strtr function in php doesn't replace everything?

I want to replace all spaces " " with "%20", but when I try to do it space gets replaced by only "%".

$test = "How are you";
$test = strtr($test," ","%20");

echo $test;

Output:

How%are%you

I need it to be:

How%20are%20you



Aucun commentaire:

Enregistrer un commentaire