2006-11-09 08:23:00 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2006-11-09 13:20:21 +00:00
|
|
|
<!-- $Revision: 1.2 $ -->
|
2006-11-09 08:23:00 +00:00
|
|
|
<refentry id="function.array-fill-keys">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>array_fill_keys</refname>
|
|
|
|
<refpurpose>Fill an array with values, specifying keys</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
<methodsynopsis>
|
|
|
|
<type>array</type><methodname>array_fill_keys</methodname>
|
|
|
|
<methodparam><type>array</type><parameter>keys</parameter></methodparam>
|
|
|
|
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
|
|
<function>array_fill_keys</function> fills an array with the
|
|
|
|
value of the <parameter>value</parameter> parameter, using the
|
|
|
|
values of the <parameter>keys</parameter> array as keys.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title><function>array_fill_keys</function> example</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
$keys = array('foo', 5, 10, 'bar');
|
|
|
|
$a = array_fill_keys($keys, 'banana');
|
|
|
|
print_r($a);
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
<para>
|
|
|
|
<varname>$a</varname> now is:
|
|
|
|
</para>
|
|
|
|
<screen>
|
|
|
|
<![CDATA[
|
|
|
|
Array
|
|
|
|
(
|
|
|
|
[foo] => banana
|
|
|
|
[5] => banana
|
|
|
|
[10] => banana
|
|
|
|
[bar] => banana
|
|
|
|
)
|
|
|
|
]]>
|
|
|
|
</screen>
|
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
See also <function>array_fill</function> and
|
|
|
|
<function>array_combine</function>.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|