= 5.2.0, PHP 7, PHP 8)spl_object_hash — 返回指定對(duì)象的hash id 說(shuō)明spl_object_hash(object $obj): string本函數(shù)為指定對(duì)象返回一個(gè)唯一標(biāo)識(shí)符。這個(gè)標(biāo)識(shí)符可用于作為保存對(duì)象或區(qū)">
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
spl_object_hash — 返回指定對(duì)象的hash id
$obj
): string本函數(shù)為指定對(duì)象返回一個(gè)唯一標(biāo)識(shí)符。這個(gè)標(biāo)識(shí)符可用于作為保存對(duì)象或區(qū)分不同對(duì)象的hash key。
object
Any object.
字符串,對(duì)于每個(gè)對(duì)象它都是唯一的,并且對(duì)同一個(gè)對(duì)象它總是相同。
示例 #1 A spl_object_hash() example
<?php
$id = spl_object_hash($object);
$storage[$id] = $object;
?>
注意:
When an object is destroyed, its hash may be reused for other objects.