Home > Backend Development > PHP Tutorial > sprintf('%04b', $forumlink['type']);这句话是什么意思?解决方案

sprintf('%04b', $forumlink['type']);这句话是什么意思?解决方案

WBOY
Release: 2016-06-13 10:37:04
Original
782 people have browsed it

sprintf('%04b', $forumlink['type']);这句话是什么意思?
sprintf('%04b', $forumlink['type'])

有点看不懂

------解决方案--------------------
%0 表示八进制数,sprintf函数将%0替换成 $forumlink['type'] 的值,替换时是转换成八进制处理的,尽管它是10进制

该函数详解请见
http://www.w3school.com.cn/php/func_string_sprintf.asp
------解决方案--------------------
把变量 $forumlink['type'] 值转换为:
有效位4的八进制数,并转换为二进制
------解决方案--------------------
应该是4位2进制数,如果不足4位,用0填充
------解决方案--------------------
保留4为小数.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template