Casting removes leading zeros
I would say because the leading zeros have no meaning when passed to an integer.
Maybe you should leave it as a string if you want those leading zeros, and only cast (int)
for whatever math you need to do (although you can just use a string too, PHP will figure it out)
change
After looking at the example, I want to echo the value before you scribble on the line (so I can confirm that something fishy isn't happening to you with the QuoteSmart method (or your send value as a parameter, $ gate)
a source to share
OK, that's why it was dropping leading zeros. It was not cast and does not add. What I did was quote the variable (which quotes are supposed to do anyway, but not for some reason). When I cast this variable, I saved the value correctly. If I'm not wrong, quotesmart will only work with strings, not ints.