So I'm having problems figuring this out. When i have exemple.com/index.php?x=true
, will the value of x with $_GET["x"]
be "true"
as a String or true
as a Boolean.
Asked
Active
Viewed 33 times
0

Elias Konrad
- 108
- 1
- 9
-
2It will be a string. You should just use truthy/falsey values (E.G `1` and `0` respectively) – GrumpyCrouton Oct 02 '17 at 19:43
-
All values from `$_GET[]`, `$_POST[]` and `$_REQUEST[]` are strings. PHP only parses the request and put the pieces there, it's your task to interpret them as you want. – axiac Oct 02 '17 at 19:44
-
1I personally would never use `true` or `false` as a value in a `$_GET` request.. instead just a integer `1` or `0` or yes/no etc – Thielicious Oct 02 '17 at 19:45