3
The question is the title by itself, in PHP we can do:
var_dump((int) "!");
And receive int(0)
.
And in Mysql we can do:
SELECT campo_int FROM tabela WHERE campo_int = "!"
What if this 'campo_int'
for '0'
he returns the record.
- Why does this happen?
- This has some usefulness planned by the language developers?
It seems to me that they are two distinct and even opposite behaviors. Swear that Mysql does this?
– Maniero
!
is not a valid int so returnsfalse
with the cast applied turns zero. Maybe it’s the same case of that question. Already in Mysql I suspect that you are not configuring asstrict mode
.– rray
@Maniero yes!! I was a little wrong in a query, and noticed that, only returns in fields int other types not
– AnthraxisBR
The question is misspelled, Mysql returns anything that does not
!
. And in fact they are two different things.– Maniero