简体   繁体   English

PHP的打印输出0500

[英]php output of print 0500

I have following php code. 我有以下PHP代码。

    <?php
           print 0505;
           echo "\n";
           print 0500;
     ?>

output =>   325
            320

can anyone tell me how come did this output? 谁能告诉我这个输出是怎么来的?

This is octal 这是八进制的

Here is a octal/decimal converter. 是一个八进制/十进制转换器。

500 oct = 320 dec 500十月= 320十二月

505 oct = 325 dec 505十月= 325十月

0x*** - hex number (16) 0x ***-十六进制数字(16)
0b*** - bin number (2, PHP5.4) 0b ***-箱号(2,PHP5.4)
0*** - oct number (8) 0 ***-十进制数字(8)
*** - dec number (10, normal) ***-十进制数(10,正常)

You can get output using this format 您可以使用这种格式获取输出

print "0505"; 打印“ 0505”;

echo "\\n"; 回显“ \\ n”;

print "0500"; 打印“ 0500”;

Because this is octal/decimal convertor 因为这是八进制/十进制转换器

please check this link: http://www.statman.info/conversions/octal.html 请检查此链接: http : //www.statman.info/conversions/octal.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM