First of all, would most of you agree that unless there is a large enough amount of data to affect performance from accumulated conversion times, it usually makes sense to store binary data as text when writing and reading files, correct?. It certainly seems easier from a troubleshooting issues, because until the file(s) are removed, they are at least humanly readable. There is plenty of storage space these days, and who needs compatibility issues when a future version of PHP defines an integer as being an 8 byte number, or another program that assumes a different byte order tries to read your files.
Second, assuming i want to save as text, what is the correct way (without taking language shortcuts) to make sure binaries stored in variables (integers, floating pt. numbers, or simple true/false states) are converted and saved as text in a file, and converted back to binary when read back from the file. PHP seems very loose with its rules over data-typing compared to other languages I’ve worked with, so I’d not be surprised if I did it technically wrong but still got a correct result. Can someone give me simple examples of the correct ways?