jetpackman Posted October 19, 2009 Share Posted October 19, 2009 Trying to Get: Decimal: 305419896 Out of: Binary String: xV4 Quote Link to comment https://forums.phpfreaks.com/topic/178245-convert-binary-string-to-decimal/ Share on other sites More sharing options...
simshaun Posted October 19, 2009 Share Posted October 19, 2009 Technically, (I think), what you posted is not a "binary" value. Check out bindec(). Quote Link to comment https://forums.phpfreaks.com/topic/178245-convert-binary-string-to-decimal/#findComment-939800 Share on other sites More sharing options...
salathe Posted October 19, 2009 Share Posted October 19, 2009 $decimal = unpack('V', $binary); Quote Link to comment https://forums.phpfreaks.com/topic/178245-convert-binary-string-to-decimal/#findComment-939802 Share on other sites More sharing options...
jetpackman Posted October 19, 2009 Author Share Posted October 19, 2009 Thanks guys. Saluthes answer worked! Coming from a C/C++ background, all these data conversions are just mind boggling. Quote Link to comment https://forums.phpfreaks.com/topic/178245-convert-binary-string-to-decimal/#findComment-939809 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.