Construct a new array object with ArrayObject::__construct from array in PHP

Description

The following code shows how to construct a new array object with ArrayObject::__construct from array.

Example


<?php/* w  w w.ja  v a  2s .co m*/
$array = array('1' => 'one',
               '2' => 'two',
               '3' => 'three');

$arrayobject = new ArrayObject($array);

var_dump($arrayobject);
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Data Types »




Array
Array Associative
Array Util
ArrayObject
Data Types
Date
Date Format
DateTime
Number
String
String Escape
String Filter
String HTML
String Type
Timezone