59.12 Difference between ? and & in an URL

In a URL, the ? and & symbols have specific roles in defining and separating parameters within the query string.
The ? symbol marks the beginning of the query string. The query string is the part of a URL that contains data to be passed to web applications such as CGI programs. It comes after the URL path and before the fragment identifier (#). The query string is composed of a series of parameters, with each parameter consisting of a key-value pair.
The & symbol, on the other hand, is used to separate individual parameters within the query string. Each parameter is a pair of a name and a value, separated by an equals sign The & symbol allows multiple parameters to be included in the query string.
For example, in the URL http://www.site.com/index.php?someVar=firstVal&otherVar=secondVal, the ? marks the start of the query string, and the & separates the two parameters: someVar=firstVal and otherVar=secondVal[1].

  1. https://stackoverflow.com/questions/18273148/php-and-in-urls-whats-the-difference ↩︎

Thoughts 🤔 by Soumendra Kumar Sahoo is licensed under CC BY 4.0