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 Link to comment https://forums.phpfreaks.com/topic/140947-solved-getting-hex/ 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 />'; } Link to comment https://forums.phpfreaks.com/topic/140947-solved-getting-hex/#findComment-737741 Share on other sites More sharing options...
asmith Posted January 15, 2009 Author Share Posted January 15, 2009 Sweet ^^ Thanks a lot man Link to comment https://forums.phpfreaks.com/topic/140947-solved-getting-hex/#findComment-737766 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.