How do I convert a string that looks like a hex number to an actual hex number in php?

前端 未结 3 1279
悲哀的现实
悲哀的现实 2020-12-18 22:13

I have a string that looks like this \"7a\" and I want to convert it to the hex number 7A. I have tried using pack and unpack but that is giving me the hex rep

3条回答
  •  清歌不尽
    2020-12-18 23:18

    Probably the simplest way to store that as an integer is hexdec()

    $num = hexdec( '7A' );
    

提交回复
热议问题