<p class="sougouContent"> 如题。 <br> <br> <br> 为什么1和2结果不同 <br> <br> 1 <br> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="sycode" name="code">2*8^2 + 4*8^1 +5128+32+5结果:165</pre><div class="contentsignin">登录后复制</div></div> <br /> <br /> <br /> 2 <br /> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="sycode" name="code">245 = 8*30 +530 = 8*3 +63 = 8*0 +3结果:365</pre><div class="contentsignin">登录后复制</div></div> </p> <br /> <h2>回复讨论(解决方案)</h2> <p class="sougouAnswer"> 代码2中,你把8进制数当做10进制数处理了 <br /> php 是这样表示 8 进制的 <br /> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="sycode" name="code">echo 0245; //165</pre><div class="contentsignin">登录后复制</div></div> <br /> php 是这样做数制转换的 <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="sycode" name="code">echo base_convert('245', 8, 10);</pre><div class="contentsignin">登录后复制</div></div> <br> <br> </p>