0

I have a string:

$fonts = "Arial:400";

When I use that in a URL, the colon prints as %3A. How can I escape the colon so that it prints as :? I have tried preg_replace and urlencode with no luck. I'm sure its simple but I have searched.

WordPress Mike
  • 448
  • 2
  • 6
  • 21

1 Answers1

3

You should be using urlencode and substitute the %3a with :

$url = urlencode($url);
$url = str_replace("%3A",":",$url);
nbaroz
  • 126
  • 1
  • 5