php-doc-en/reference/spl/splfixedarray/fromarray.xml
2011-08-16 11:38:58 +00:00

120 lines
2.7 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!-- $Revision$ -->
<refentry xml:id="splfixedarray.fromarray" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>SplFixedArray::fromArray</refname>
<refpurpose>Import a PHP array in a <classname>SplFixedArray</classname> instance</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <modifier>static</modifier> <type>SplFixedArray</type><methodname>SplFixedArray::fromArray</methodname>
<methodparam><type>array</type><parameter>array</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>save_indexes</parameter><initializer>true</initializer></methodparam>
</methodsynopsis>
<para>
Import the PHP array <parameter>array</parameter>
in a new <classname>SplFixedArray</classname> instance
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>array</parameter></term>
<listitem>
<para>
The array to import.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>save_indexes</parameter></term>
<listitem>
<para>
Try to save the numeric indexes used in the original array.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an instance of <classname>SplFixedArray</classname>
containing the array content.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>SplFixedArray::fromArray</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$fa = SplFixedArray::fromArray(array(1 => 1, 0 => 2, 3 => 3));
var_dump($fa);
$fa = SplFixedArray::fromArray(array(1 => 1, 0 => 2, 3 => 3), false);
var_dump($fa);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
object(SplFixedArray)#1 (4) {
[0]=>
int(2)
[1]=>
int(1)
[2]=>
NULL
[3]=>
int(3)
}
object(SplFixedArray)#2 (3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->