Home
My Account
About us
Products
Support Services
Buy online
Downloads
Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
PHP Manual
Data Structures
Installing/Configuring
Examples
Ds\Collection
Ds\Hashable
Ds\Sequence
Ds\Vector
Ds\Deque
Ds\Map
Ds\Pair
Ds\Set
Ds\Stack
Ds\Queue
Ds\PriorityQueue
Ds\Map::xor
Ds\Pair::clear
Data Structures
Last updated: Mon, 26 Oct 2026
The Pair class
(PECL ds >= 1.0.0)
Introduction
A pair is used by
Ds\Map
to pair keys with values.
Class synopsis
class
Ds\Pair
implements
JsonSerializable
{
/* Methods */
public
function
__construct
(
mixed
$key
= ?
,
mixed
$value
= ?
)
public
function
clear
():
void
public
function
copy
():
Ds\Pair
public
function
isEmpty
():
bool
public
function
toArray
():
array
}
Table of Contents
Ds\Pair::clear
— Removes all values
Ds\Pair::__construct
— Creates a new instance
Ds\Pair::copy
— Returns a shallow copy of the pair
Ds\Pair::isEmpty
— Returns whether the pair is empty
Ds\Pair::jsonSerialize
— Returns a representation that can be converted to JSON
Ds\Pair::toArray
— Converts the pair to an array
Ds\Map::xor
Ds\Pair::clear
Data Structures
Last updated: Mon, 26 Oct 2026