bin2hex()

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nabanita
    New Member
    • Mar 2010
    • 9

    bin2hex()

    how does the bin2hex() function works? do it changes the original file to its equivalent hexadecimal form or it copies the file to the buffer and works with it??
    In the second case, I would like to know if there is a function or a way that would convert the original file to its hexadecimal form
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey.

    The bin2hex function simply takes a string, converts it to it's hexadecimal form, and then returns the new HEX string. (The input string is not altered, unless you overwrite it with the return value, if that is what you are asking.)

    To convert an entire file into it's HEX equivalent, you need to load the file into PHP, run the binary string through the function, and then save it or output it or do whatever you want done with it.

    Note that a file encoded in HEX is 2x larger than it's binary form, so you may find there are better ways to do whatever it is you want to do with it. (What are you planing to do with it?)

    Comment

    Working...