跳至內容區

Bake_WP空間

Bake_WP空間

日期:2024 年 9 月 29 日

sprintf函式

(PHP 4, PHP 5, PHP 7, PHP 8)

sprintf — 返回格式化字符串

sprintf(string $format, mixed …$values): string

符號表示

S 以字串方式顯示

d以整數方式顯示

<?php
$num = 5;
$location = 'tree';

$format = 'There are %d monkeys in the %s';
echo sprintf($format, $num, $location);
?>

以上範例會输出:

There are 5 monkeys in the tree

作者 bake發表於 2024 年 9 月 29 日2025 年 2 月 18 日分類 PHP函數留下一則迴響 在 sprintf函式

sizeof 函數

sizeof — count() 的别名

參數

數值或變數

返回值: int

If your array is "huge"

It is reccomended to set a variable first for this case:

THIS->

$max = sizeof($huge_array);
for($i = 0; $i < $max;$i++)
{
code...
}

作者 bake發表於 2024 年 9 月 29 日2025 年 2 月 18 日分類 PHP函數留下一則迴響 在 sizeof 函數

近期文章

  • 圖說演算法使用JavaScript(十八)
  • 圖說演算法使用JavaScript(十七)
  • PHP陣列key值為負數
  • PHP 怎麼用parseInt
  • 圖說演算法使用JavaScript(十六)

分類

  • PHP筆記 (28)
    • PHP函數 (16)
  • 心情寫真 (19)
    • 花花草草 (3)
    • 音樂兩三四 (1)
  • 書籍筆記 (63)
    • JavaScript概念三明治 (6)
    • JavaScript精選14堂 (5)
    • Laravel8 (2)
    • PHP4-design (3)
    • PHPCookBook (10)
    • SQL指令語法速查手冊 (10)
    • 圖說演算法-JavaScript (18)
    • 資料庫系統理論 (9)
  • 程式語言及主機安裝 (13)
    • sublime (1)
  • 運動賽會 (4)

標籤

  • 好心情
  • 學習中
  • 疑惑~
  • 精選
九月 2024
一 二 三 四 五 六 日
« 八月   十月 »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

彙整

  • 2025 年 六月 (4)
  • 2025 年 五月 (8)
  • 2025 年 四月 (7)
  • 2025 年 三月 (17)
  • 2025 年 二月 (11)
  • 2025 年 一月 (4)
  • 2024 年 十二月 (12)
  • 2024 年 十一月 (11)
  • 2024 年 十月 (8)
  • 2024 年 九月 (27)
  • 2024 年 八月 (11)
  • 2024 年 六月 (4)

The wise proverb

Yesterday is history.

Tomorrow is a mystery.

Today is a gift!

在別人貪婪時恐懼,在別人恐懼時貪婪。

by 巴菲特

 

“Slow and steady wins the race.”

by Aesop’s Fables

其它

  • 登入
  • 文章 RSS 訂閱
  • 迴響 RSS 訂閱
  • WordPress 台灣正體中文
Bake_WP空間 本站使用 WordPress 建置