<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # PHP vsprintf() 函數 ## 定義和用法 vsprintf() 函數把格式化字符串寫入變量中。 與 [sprintf()](/php/func_string_sprintf.asp "PHP sprintf() 函數") 不同,vsprintf() 中的 _arg_ 參數位于數組中。數組的元素會被插入主字符串的百分比 (%) 符號處。該函數是逐步執行的。在第一個 % 符號中,插入 arg1,在第二個 % 符號處,插入 arg2,依此類推。 ### 語法 ``` vsprintf(format,argarray) ``` | 參數 | 描述 | | --- | --- | | format | 必需。轉換格式。 | | argarray | 必需。帶有參數的一個數組,這些參數會被插到 format 字符串中的 % 符號處。 | ### 說明 參數 _format_ 是轉換的格式,以百分比符號 ("%") 開始到轉換字符結束。下面的可能的 _format_ 值: * %% - 返回百分比符號 * %b - 二進制數 * %c - 依照 ASCII 值的字符 * %d - 帶符號十進制數 * %e - 可續計數法(比如 1.5e+3) * %u - 無符號十進制數 * %f - 浮點數(local settings aware) * %F - 浮點數(not local settings aware) * %o - 八進制數 * %s - 字符串 * %x - 十六進制數(小寫字母) * %X - 十六進制數(大寫字母) ## 提示和注釋 注釋:如果 % 符號多于 _arg_ 參數,則您必須使用占位符。占位符插到 % 符號后面,由數字和 "\$" 組成。請參見例子 3。 提示: 相關函數: [fprintf()](/php/func_string_fprintf.asp "PHP fprintf() 函數")、 [printf()](/php/func_string_printf.asp "PHP printf() 函數")、 [sprintf()](/php/func_string_sprintf.asp "PHP sprintf() 函數")、 [vfprintf()](/php/func_string_vfprintf.asp "PHP vfprintf() 函數") 以及 [vprintf()](/php/func_string_vprintf.asp "PHP vprintf() 函數")。 ## 例子 ### 例子 1 ``` <?php $str = "Hello"; $number = 123; $txt = vsprintf("%s world. Day number %u",array($str,$number)); echo $txt; ?> ``` 輸出: ``` Hello world. Day number 123 ``` ### 例子 2 ``` <?php $num1 = 123; $num2 = 456; $txt = vsprintf("%f%f",array($num1,$num2)); echo $txt; ?> ``` 輸出: ``` 123.000000456.000000 ``` ### 例子 3 使用占位符: ``` <?php $number = 123; $txt = vsprintf("With 2 decimals: %1\$.2f <br />With no decimals: %1\$u",array($number)); echo $txt; ?> ``` 輸出: ``` With 2 decimals: 123.00 With no decimals: 123 ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看