Understanding str_pad() with leading zeros

爷,独闯天下 提交于 2019-11-28 14:23:44
Kerrek SB

Integer literals starting with 0 are interpreted base 8. Your second $x has the value 83. See the manual on integers for details.

The intval() function lets you specify the base if you're reading a user string.

If we're talking about literals, in PHP the literal 0 is decimal, while in C and C++ it is octal. It's the little differences that make life fun.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!