Home > Article > Backend Development > How to write binary files in php
How to write binary files in php
How to write binary files in php
After
php v4 there is pack
php.net pack — Pack data into binary string
<code>$bom = mb_convert_encoding("", "unicode", "HTML-ENTITIES"); $fp = fopen('text.txt', 'w'); fwrite($fp, pack('a2', $bom)); </code>