only like this: $int = array[0] + (array[1] << 8) + (array[2] << 16) + (array[3] << 24); ? I can't use type casting because it will make a '1111'(4-bytes array) string into 1111(2-byte int), and it's not what i want. If mask is a int variable, mask.bin if a file with only 4-byte, so: $mask = file_get_contents('mask.bin'); will make $mask a string not a int??? Are PHP string variable a pointer to first char in the array? I come from C++... Thanks