Hi,

First time posting to the doc list, so I hope this is helpful, etc.  I
requested the array_fill_keys() function awhile ago and figured I should
help a bit by sending some basic documentation for it. :-)  I worked from
array-fill.xml and just saved the "middle" part (between comments), to let
someone who knows what they're doing fill in the rest!  Don't know if the
wording needs to be tweaked or such, but it's a start...


Matt
<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>

Reply via email to