|
SplObjectStorage::getHashCalculate a unique identifier for the contained objects Description
public string SplObjectStorage::getHash
( object
$object
)This method calculates an identifier for the objects added to an SplObjectStorage object. The implementation in SplObjectStorage returns the same value as spl_object_hash. The storage object will never contain more than one object with the same identifier. As such, it can be used to implement a set (a collection of unique values) where the quality of an object being unique is determined by the value returned by this function being unique. Parameters
Return ValuesA string with the calculated identifier. Errors/ExceptionsA RuntimeException is thrown when the returned value is not a string. Examples
Example #1 SplObjectStorage::getHash example
<?php The above example will output something similar to: 2 3 See Also
|