PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
There's a couple of issues with the code, but a better question is why do you think this is necessary? Is this for something that is not web related?
To help you with the code:
After the for loop in the enc() function you need: return $temp; (otherwise as you said nothing gets returned.)
You are reading these files bytewise, but then treating them like an array of bytes...why?
The bitwise operator ~ is going to change some standard ASCII characters into binary values which your .txt file system might not support or may get garbled.