a simple patch that i have done when encountering this problem was this

if (x %var1 === x %var2)

so you get

if (x 123456789123456789123456789123 === x 123456789123456789123456789122) echo -a true

* simply stops being a number