I have a variable id = 1615239032
In python i do
You already get the same as in Python. It gets corrupted when you try to display it.
If you convert the binary data to something else, for instance their hexadecimal represantions, you'll see that they are the same:
echo bin2hex("x\x97F`"); echo "<br>"; echo bin2hex(pack("i", 1615239032));