Home  >  Article  >  Backend Development  >  (245)8 的八进制展开是多少啊(8是下标)

(245)8 的八进制展开是多少啊(8是下标)

WBOY
WBOYOriginal
2016-06-23 14:18:032204browse

如题。


为什么1和2结果不同

1

2*8^2 + 4*8^1 +5128+32+5结果:165



2
245 = 8*30 +530  = 8*3  +63   = 8*0  +3结果:365


回复讨论(解决方案)

代码2中,你把8进制数当做10进制数处理了
php 是这样表示 8 进制的

echo 0245; //165

php 是这样做数制转换的
echo base_convert('245', 8, 10);


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn