PHP Doku:: Creates a copy of the ArrayObject. - arrayobject.getarraycopy.html

Verlauf / Chronik / History: (2) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzSonstige GrunderweiterungenStandard PHP Library (SPL)Verschiedene Klassen und InterfacesThe ArrayObject classArrayObject::getArrayCopy

Ein Service von Reinhard Neidl - Webprogrammierung.

The ArrayObject class

<<ArrayObject::exchangeArray

ArrayObject::getFlags>>

ArrayObject::getArrayCopy

(PHP 5 >= 5.0.0)

ArrayObject::getArrayCopyCreates a copy of the ArrayObject.

Beschreibung

array ArrayObject::getArrayCopy ( void )

Exports the ArrayObject to an array.

Parameter-Liste

Diese Funktion hat keine Parameter.

Rückgabewerte

Returns a copy of the array. When the ArrayObject refers to an object an array of the public properties of that object will be returned.

Beispiele

Beispiel #1 ArrayObject::getArrayCopy() example

<?php
// Array of available fruits
$fruits = array("lemons" => 1"oranges" => 4"bananas" => 5"apples" => 10);

$fruitsArrayObject = new ArrayObject($fruits);
$fruitsArrayObject['pears'] = 4;

// create a copy of the array
$copy $fruitsArrayObject->getArrayCopy();
print_r($copy);

?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

Array
(
    [lemons] => 1
    [oranges] => 4
    [bananas] => 5
    [apples] => 10
    [pears] => 4
)


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)