📄 function.is-bool.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Finds out whether a variable is a boolean</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.is-binary.html">is_binary</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.is-buffer.html">is_buffer</a></div> <div class="up"><a href="ref.var.html">Variable handling Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.is-bool" class="refentry"> <div class="refnamediv"> <h1 class="refname">is_bool</h1> <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">is_bool</span> — <span class="dc-title"> Finds out whether a variable is a boolean </span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><b><b>is_bool</b></b></span> ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <tt class="parameter">$var</tt></span> )</div> <p class="para rdfs-comment"> Finds whether the given variable is a boolean. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">var</tt></i></span> <dd> <p class="para"> The variable being evaluated. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <b><tt>TRUE</tt></b> if <i><tt class="parameter">var</tt></i> is a <a href="language.types.boolean.html" class="type boolean">boolean</a>, <b><tt>FALSE</tt></b> otherwise. </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 <b>is_bool()</b> examples</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br />$a </span><span style="color: #007700">= </span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$b </span><span style="color: #007700">= </span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// Since $a is a boolean, this is true<br /></span><span style="color: #007700">if (</span><span style="color: #0000BB">is_bool</span><span style="color: #007700">(</span><span style="color: #0000BB">$a</span><span style="color: #007700">)) {<br /> echo </span><span style="color: #DD0000">"Yes, this is a boolean"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #FF8000">// Since $b is not a boolean, this is not true<br /></span><span style="color: #007700">if (</span><span style="color: #0000BB">is_bool</span><span style="color: #007700">(</span><span style="color: #0000BB">$b</span><span style="color: #007700">)) {<br /> echo </span><span style="color: #DD0000">"Yes, this is a boolean"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> </div> <div class="refsect1 seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="function.is-float.html" class="function" rel="rdfs-seeAlso">is_float()</a></li> <li class="member"><a href="function.is-int.html" class="function" rel="rdfs-seeAlso">is_int()</a></li> <li class="member"><a href="function.is-string.html" class="function" rel="rdfs-seeAlso">is_string()</a></li> <li class="member"><a href="function.is-object.html" class="function" rel="rdfs-seeAlso">is_object()</a></li> <li class="member"><a href="function.is-array.html" class="function" rel="rdfs-seeAlso">is_array()</a></li> </ul> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.is-binary.html">is_binary</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.is-buffer.html">is_buffer</a></div> <div class="up"><a href="ref.var.html">Variable handling Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -