$url = "https://www.example.com/index.php?name=John"; $parsed_url = parse_url($url); print_r($parsed_url);
Array ( [scheme] => https [host] => www.example.com [path] => /index.php [query] => name=John )
$name = "John Doe"; $encoded_name = urlencode($name); echo $encoded_name;
John+Doe
$params = array('name' => 'John', 'age' => '30'); $query_string = http_build_query($params); echo $query_string;
name=John&age=30These functions are built-in PHP functions and do not require any external package library.