array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'ds-map.copy.php', 1 => 'Ds\\Map::copy', 2 => 'Returns a shallow copy of the map', ), 'up' => array ( 0 => 'class.ds-map.php', 1 => 'Ds\\Map', ), 'prev' => array ( 0 => 'ds-map.construct.php', 1 => 'Ds\\Map::__construct', ), 'next' => array ( 0 => 'ds-map.count.php', 1 => 'Ds\\Map::count', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/ds/ds/map/copy.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

Ds\Map::copy

(PECL ds >= 1.0.0)

Ds\Map::copyReturns a shallow copy of the map

Beschreibung

public Ds\Map::copy(): Ds\Map

Returns a shallow copy of the map.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

Returns a shallow copy of the map.

Beispiele

Beispiel #1 Ds\Map::copy() example

<?php
$map
= new \Ds\Map([
"a" => 1,
"b" => 2,
"c" => 3,
]);

print_r($map->copy());
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

Ds\Map Object
(
    [0] => Ds\Pair Object
        (
            [key] => a
            [value] => 1
        )

    [1] => Ds\Pair Object
        (
            [key] => b
            [value] => 2
        )

    [2] => Ds\Pair Object
        (
            [key] => c
            [value] => 3
        )

)