查詢

Ds\Pair::isEmpty()函式—用法及示例

「 檢查 Pair 物件是否為空 」


函式名: Ds\Pair::isEmpty()

函式描述: isEmpty() 方法用於檢查 Pair 物件是否為空。

用法:

public function isEmpty(): bool

示例:

use Ds\Pair;

$pair = new Pair('key', 'value');

// 檢查 Pair 物件是否為空
if ($pair->isEmpty()) {
    echo "Pair 物件為空";
} else {
    echo "Pair 物件不為空";
}

輸出:

Pair 物件不為空

版本要求: 使用 Ds\Pair 類及其 isEmpty() 方法需要 PHP 7.3 或更高版本。

補充糾錯
上一個函式: Ds\Pair::copy()函式
下一個函式: Ds\Pair::jsonSerialize()函式
熱門PHP函式
分享連結