Convert binary string to integer in php

感情迁移 提交于 2020-01-11 11:04:23

问题


In php how do I convert a string "1010101010" into the integer value represented by this binary number?

eg "10" would go to 2, "101" would go to 5


回答1:


Use bindec() function to convert from binary to decimal:

$value = bindec("10101011010101");



回答2:


Try the bindec() function.



来源:https://stackoverflow.com/questions/4424746/convert-binary-string-to-integer-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!