PHP速学教程(入门到精通)
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
这篇文章主要介绍了php实现将任意进制数转换成10进制的方法,涉及php数制转换的相关技巧,非常具有实用价值,需要的朋友可以参考下
本文实例讲述了php实现将任意进制数转换成10进制的方法。分享给大家供大家参考。具体如下:
php将任意进制的数转换成10进制,例如8进制转换成10进制,,16进制转换成10进制
Convert the base $base number $number to a base 10 number:
"; print "Convert the integer component ($integer) of the number:"; // Compute the value of the integer component // Loop through the integer digit by digit // Reverse the number for easier handling $integer = strrev ($integer); $length = strlen ($integer); for ($pos = 0; $pos '; if (isset ($decimal)) { print "Convert the decimal component (0.$decimal) of the number:The value of the base $base number $number in base 10 is $base_10_value."; // Pad the number with a leading 0 so that we can // start at position 1 $decimal = '0'.$decimal; $length = strlen ($decimal); for ($pos = 1; $pos "; print "$digit * 1/$base$pos = $result'; } $sums = implode (' + ', $sums); eval ("\$base_10_value = $sums;"); print "
"; $sums[] = $result; } print '
希望本文所述对大家的php程序设计有所帮助。
php免费学习视频:立即学习
踏上前端学习之旅,开启通往精通之路!从前端基础到项目实战,循序渐进,一步一个脚印,迈向巅峰!
已抢7202个
抢已抢94818个
抢已抢14816个
抢已抢52063个
抢已抢194660个
抢已抢87259个
抢