I\'m looking to replace all instances of spaces in urls with %20. How would I do that with regex?
Thank you!
public static function normalizeUrl(string $url) { $parts = parse_url($url); return $parts['scheme'] . '://' . $parts['host'] . implode('/', array_map('rawurlencode', explode('/', $parts['path']))); }