(PHP 8)
get_resource_id — 傳回指定資源的整數識別碼
$resource
此函式提供一種類型安全的方式來產生資源的整數識別碼。
resource
被評估的資源句柄。
給定 resource 的 int 識別碼。
此函式本質上是將 resource 轉換為 int,以便更容易取得資源 ID。
範例 #1 get_resource_id() 產生的結果與 int 轉換相同
<?php$handle = fopen("php://stdout", "w");echo (int) $handle . "\n";echo get_resource_id($handle);?>
上述範例將輸出類似以下的內容
698 698