View Full Version : .dat and .txt files

06-07-2007, 08:34 AM
Is there any difference when including a .dat or .txt file?
I havent seen any difference with its effectiveness, both can store content and print, besides .dat looks like a cooler extention to organize files - is there any gain?

06-07-2007, 02:20 PM
In fact the .dat file can be just .txt file with .dat extension :) but originally text files .txt consist of lines terminated with a CR/LF (#13#10) combination (or just LF Unix/Linux or CR Mac), and typed files .dat consist of data taken from a particular type of data structure.

06-07-2007, 10:14 PM
A .dat file can contain ANYTHING depending on which program it is intended to be used with. In most cases it will not contain readable text or if it does there will usually be non readable portions as well.

06-07-2007, 10:37 PM
Even though you posted this in the HTML forum section, I assume that you are talking about using PHP to include these?

A word of caution about putting PHP code (including PHP variable and constant define(...) statements) in files that do not have a .php extension. If you put PHP code/variable/define statements in files that have a .htm, .html, .txt, .dat, .inc, ... or any other extension that is not parsed by the PHP language engine, then anyone that learns or guesses the file name can directly browse (or use a script) to your file and see the exact contents of that file. Only put PHP code/variable/define statements in a .php file (or an alternate extension that you have setup on your server to be parsed as PHP code.)