久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php怎么將布爾類型轉(zhuǎn)為字符串

      php將布爾類型轉(zhuǎn)為字符串的方法:1、使用strval()函數(shù),語(yǔ)法“strval($bool)”;2、使用settype()函數(shù),語(yǔ)法“settype($bool, 'string')”。

      php怎么將布爾類型轉(zhuǎn)為字符串

      本教程操作環(huán)境:windows7系統(tǒng)、PHP7.1版、DELL G3電腦

      php將布爾類型轉(zhuǎn)為字符串

      方法1:使用strval()函數(shù)

      strval()函數(shù):用于獲取變量的字符串值。

      示例:

      <?php header("Content-type:text/html;charset=utf-8"); $bool1=true; $bool2=false; echo '變量 $bool1 的類型為:'.gettype($bool1).'<br>'; echo '變量 $bool2 的類型為:'.gettype($bool2).'<br><br>'; $str1=strval($bool1); echo '變量 $str1 的類型為:'.gettype($str1).'<br>'; $str2=strval($bool2); echo '變量 $str2 的類型為:'.gettype($str2).'<br>'; ?>

      效果圖:

      php怎么將布爾類型轉(zhuǎn)為字符串

      方法2:使用settype()函數(shù)

      settype()函數(shù):用于設(shè)置變量的類型。

      其可以設(shè)置的類型為:

      • "boolean" (或?yàn)?quot;bool",從 PHP 4.2.0 起)

      • "integer" (或?yàn)?quot;int",從 PHP 4.2.0 起)

      • "float" (只在 PHP 4.2.0 之后可以使用,對(duì)于舊版本中使用的"double"現(xiàn)已停用)

      • "string"

      • "array"

      • "object"

      • "null" (從 PHP 4.2.0 起)

      注:settype() 函數(shù)會(huì)改變變量本身的類型。

      示例:

      <?php header("Content-type:text/html;charset=utf-8"); $bool1=true; $bool2=false; echo '原 $bool1 的類型為:'.gettype($bool1).'<br> 原 $bool2 的類型為:'.gettype($bool2)."<br><br>"; settype($bool1, 'string'); settype($bool2, 'string'); echo '現(xiàn) $bool1 的類型為:'.gettype($bool1).'<br> 現(xiàn) $bool2 的類型為:'.gettype($bool2);  ?>

      效果圖:

      php怎么將布爾類型轉(zhuǎn)為字符串

      推薦學(xué)習(xí):《PHP視頻教程》

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)