Read a file in hex/bin/dec format with PHP
Posted: Thu Apr 05, 2007 12:37 pm
Is there some PHP function which I don't know which reads a file but returns it as hex/bin/dec and not as a string?
I'll clarify. Say I use this function to read a .gif image (which starts with "GIF" - like any valid .gif image) and I do:
All I really want is a way to read file (from any type) byte by byte, or even bit after bit if possible.
P.S I'm working on something very cool and if I ever manage to finish it, a lot of PHP programmers will thank me
Edit: I see this is my 1111 post
I'll clarify. Say I use this function to read a .gif image (which starts with "GIF" - like any valid .gif image) and I do:
Code: Select all
$data = this_secret_func_which_idk('my_image.gif'); // let's say it returns the data in hex format
echo $data{0}; // prints '47' since 'G' = 0x47P.S I'm working on something very cool and if I ever manage to finish it, a lot of PHP programmers will thank me
Edit: I see this is my 1111 post