note 6085 modified in fputs by ronabop

From: Date: Sat, 12 Aug 2000 21:48:37 +0000
Subject: note 6085 modified in fputs by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-1594@lists.php.net to get a copy of this message
The way I understand fputs (which is purported as an alias to fwrite which can be "Binary Safe")... <pre>$fp = fopen("something.txt","w"); $string = "Hello World\\n"; // escape the slash from being magically // being transformed into a newline fwrite($fp, $string); // will proccess /n as newline ... fwrite($fp, $string, strlen($string)); // will write the entire string to file without changing the '/n' // into a single byte for newline on Unix-like machines or CR/LF on Win32 machines </pre> Hope this helps explain the definition of "could be Binary Safe". This is the reason why you must specify the length! --Doug http://www.php.net/manual/function.fputs.php

« previous php.notes (#1594) next »