note 6085 modified in function.fputs by felipe
| From: | felipe@php.net | Date: | Sun, 20 Jul 2008 23:45:52 +0000 |
| Subject: | note 6085 modified in function.fputs by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142365@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")...
<?php
$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
?>
Hope this helps explain the definition of "could be Binary Safe". This is the reason why
you must specify the length!
--Doug
--was--
The way I understand fputs (which is purported as an alias to fwrite which can be "Binary
Safe")...
$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
Hope this helps explain the definition of "could be Binary Safe". This is the reason why
you must specify the length!
--Doug
http://php.net/manual/en/function.fputs.php