What about: $string = chr($num >> 24) . chr(($num >> 16) & 0xFF) . chr(($num >> 8) & 0xFF) . chr($num & 0xFF); (big endian) Depending on how chr works, you might even get away with removing the & 0xFF. Steven Wittens