Ds\Hashable::hashReturns a scalar value to be used as a hash value. Description
abstract public mixed Ds\Hashable::hash
( void
)
Returns a scalar value to be used as the hash value of the objects.
While the hash value does not define equality, all objects that are equal according to Ds\Hashable::equals
must have the same hash value. Hash values of equal objects don't have to be unique, for example
you could just return This method allows objects to be used as keys in structures such as Ds\Map and Ds\Set, or any other lookup structure that honors this interface. Caution
Do not pick a value that might change within the object, such as a public property. Hash table lookups would fail because the hash has changed. Caution
All objects that are equal must have the same hash value. ParametersThis function has no parameters. Return ValuesA scalar value to be used as this object's hash value. ExamplesExample #1 Ds\Hashable::hash example
<?php |