Click to See Complete Forum and Search --> : PHP - Converting DOS File to Unix
Flukey
03-13-2008, 12:00 PM
Hi there,
How do i go about converting a dos file into a unix file by using php? i.e. carriage returns etc.
regards,
Flukey :)
tfk11
03-13-2008, 01:32 PM
Lookup str_replace and file handling functions in the php manual.
Flukey
03-13-2008, 04:09 PM
Lookup str_replace and file handling functions in the php manual.
Obviously i've done all that, however, i don't know all the stuff i'm looking for etc. :)
tfk11
03-13-2008, 06:49 PM
Oh. :)
The only differences I'm aware of are the characters that mark the end of a line. DOS uses CR+LF, unix uses just a LF and I think macs use just a CR.
felgall
03-13-2008, 08:17 PM
Oh. :)
The only differences I'm aware of are the characters that mark the end of a line. DOS uses CR+LF, unix uses just a LF and I think macs use just a CR.
That's a bit dated. Since OS/X Macs have used LF the same as unix.
$unixfile = str_replace("\r\n", "\n", $dosfile);