intval() changes values

Asked

Viewed 39 times

0

Today I was making a web application working with $_REQUEST.

However I noticed that when performing an UPDATE the value went wrong, and when I looked at the functions in php, that was the most bizarre.

Realize that the intval() when you receive the request, the value changes completely!

inserir a descrição da imagem aqui

Can anyone tell me why this happens?

  • It seems to me that your variable is greater than the value allowed for the type "int" in 32bit systems and possibly when you use intval() it changes to the highest possible value.

  • Shows the code that generated this difference

  • 2

    Take a look at doc: http://php.net/manual/en/function.intval.php

  • This is probably happening because the maximum value of int is 2147483647*. With the reported value exceeds this maximum value, it is reduced.

  • @Diegoschmidt blza man, thanks for your help. I believe that in this case, because it’s registration fields, it’s important to use a limiter or something like that, I didn’t know there was such a thing!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.