asmith Posted January 15, 2009 Share Posted January 15, 2009 Hi, I have a file on windows, that I open it with hex editor programs. For example it starts with (in hex editor) : 01 0a 0a 0a 00 ... I want to get these values with php. $filename = "file.CCW"; $handle = fopen($filename, "rb"); $contents = fread($handle, filesize($filename)); fclose($handle); It is not giving me the hex, is there a function for getting the hex out of it? Thanks Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted January 15, 2009 Share Posted January 15, 2009 for($i = 0; $i < 5; $i++) { $charHex = substr(bin2hex($contents{$i}),-2); echo $charHex.'<br />'; } Quote Link to comment Share on other sites More sharing options...
asmith Posted January 15, 2009 Author Share Posted January 15, 2009 Sweet ^^ Thanks a lot man Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.