How do I get the byte values of a string in PHP?

后端 未结 4 1698
天命终不由人
天命终不由人 2020-11-30 06:48

Say I have a string in php, that prints out to a text file like this:

nÖ§9q1Fª£

How do I get the byte codes of this to my text file rather than the funky asc

4条回答
  •  南笙
    南笙 (楼主)
    2020-11-30 07:00

    If you are talking about the hex value, this should do for you:

    $value = unpack('H*', "Stack");
    echo $value[1];
    

    Reference

提交回复
热议问题