Results of 1 - 3 of about 3 for HashableObject (0.002 sec.)
- Ds\Set::add — Adds values to the set | PHP 8.3 10845
- Ds\Set::add (PECL ds >= 1.0.0) Ds\Set::add — Adds values to the set 説明 public function Ds\Set::add ( mixed ...$values ): void Adds all given values to the set that haven't already been added. 注意 : Values of type object are supported. If
... nt(1) [1]=> int(2) [2]=> int(3) [3]=> string(1) "1" [4]=> bool(true) } 例2 Ds\Set::add() example using objects <?php class HashableObject implements \Ds\Hashable { /** * An arbitrary value to use as the hash value. Does not define equality. */ private $value ; ... t will add them all. $set -> add (new \stdClass ()); $set -> add (new \stdClass ()); // Adding multiple instances of equal hashable objects will only add the first. $set -> add (new \HashableObject ( 1 )); $set -> add (new \HashableObject ( 1 )); $set -> add ( ... new \HashableObject ( 2 )); $set -> add (new \HashableObject ( 2 )); var_dump ( $set ); ?> 上の例の出力は、 たとえば以下のようになります。 obj ...
-
https://man.mtool.work/php/8.3/ds-set.add.html
- Ds\Map::put — Associates a key with a value | PHP 8.3 10361
- Ds\Map::put (PECL ds >= 1.0.0) Ds\Map::put — Associates a key with a value 説明 public function Ds\Map::put ( mixed $key , mixed $value ): void Associates a key with a value , overwriting a previous association if one exists. 注意 : Keys of
... ue] => 2 ) [2] => Ds\Pair Object ( [key] => c [value] => 3 ) ) 例2 Ds\Map::put() example using objects as keys <?php class HashableObject implements \Ds\Hashable { /** * An arbitrary value to use as the hash value. Does not define equality. */ private $value ; ... associations. $map -> put (new \stdClass (), 3 ); $map -> put (new \stdClass (), 4 ); // Using multiple instances of equal hashable objects will overwrite previous values. $map -> put (new \HashableObject ( 1 ), 5 ); $map -> put (new \HashableObject ( 1 ), 6 ) ... ; $map -> put (new \HashableObject ( 2 ), 7 ); $map -> put (new \HashableObject ( 2 ), 8 ); var_dump ( $map ); ?> 上の例の出力は、 たとえば以下のようになりま ...
-
https://man.mtool.work/php/8.3/ds-map.put.html
- Ds\Hashable::hash — Returns a scalar value to be used as a hash value | PHP 8.3 6678
- Ds\Hashable::hash (PECL ds >= 1.0.0) Ds\Hashable::hash — Returns a scalar value to be used as a hash value 説明 abstract public function Ds\Hashable::hash (): mixed Returns a scalar value to be used as the hash value of the objects. While t
... はありません。 戻り値 A scalar value to be used as this object's hash value. 例 例1 Ds\Hashable::hash() example <?php class HashableObject implements \Ds\Hashable { private $name ; private $email ; public function __construct ( $name , $email ) { $this -> name ...
-
https://man.mtool.work/php/8.3/ds-hashable.hash.html
PREV
1
NEXT