Web lists-archives.com

[PHP] how to display the binary form of the file with php?

Every file can be displayed in the binary form no matter which encoding the file is.(utf-8 gbk  iso-8859-1  latin-1)
    `xxd  filename` can do the trick.

Now i want to do with php,here is my try.

<?php     $target="test.txt";     $file_handle = fopen($target, "rb");     while (!feof($file_handle)) {        $byte = fread($file_handle,1);        echo $byte;     }     fclose($file_handle ); ?> 
It is unlucky that all the character is not displayed on binary form,how to  fix `echo $byte`  ?