[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-doc-cvs
Subject:    Re: [DOC-CVS] svn: /phpdoc/en/trunk/reference/array/functions/ array-map.xml
From:       Peter Cowburn <petercowburn () gmail ! com>
Date:       2019-05-21 17:20:03
Message-ID: CAPg3Xx+Fn6ZEKLT0dn1YCjDqGVpEW=9HnqCfRdBo_8pRxECrFQ () mail ! gmail ! com
[Download RAW message or body]


On Tue, 21 May 2019 at 17:15, George Peter Banyard <girgias@php.net> wrote:

> girgias                                  Tue, 21 May 2019 16:15:12 +0000
>
> Revision: http://svn.php.net/viewvc?view=revision&revision=347462
>
> Log:
> Add a note that NULL can be used as a callback and an additional example
> showing that array-map returns the original array if only one array is
> provided with a NULL callback.
>
> Changed paths:
>     U   phpdoc/en/trunk/reference/array/functions/array-map.xml
>
> Modified: phpdoc/en/trunk/reference/array/functions/array-map.xml
> ===================================================================
> --- phpdoc/en/trunk/reference/array/functions/array-map.xml     2019-05-21
> 15:45:56 UTC (rev 347461)
> +++ phpdoc/en/trunk/reference/array/functions/array-map.xml     2019-05-21
> 16:15:12 UTC (rev 347462)
> @@ -36,6 +36,18 @@
>        <para>
>         Callback function to run for each element in each array.
>        </para>
> +      <note>
> +       <para>
> +        &null; can be passed as a value to <parameter>callback</parameter>
> +        to perform a ZIP operation on multiple arrays.
> +        <warning>
> +         <simpara>
> +          If only <parameter>array1</parameter> is provided,
> +          <methodname>array_map</methodname> will return the input array.
> +         </simpara>
> +        </warning>
> +       </para>
> +      </note>
>

I don't think this description warrants a <note> and particularly not a
<warning>. It should just be another normal paragraph in the description of
this parameter.  Also, "ZIP" should not be capitalised.


>       </listitem>
>      </varlistentry>
>      <varlistentry>
> @@ -220,7 +232,7 @@
>    </para>
>    <para>
>     <example>
> -    <title>Creating an array of arrays</title>
> +    <title>Performing a ZIP operation of arrays</title>
>      <programlisting role="php">
>  <![CDATA[
>  <?php
> @@ -283,8 +295,38 @@
>     if exactly one array is passed. If more than one array is passed, the
>     returned array will have sequential integer keys.
>    </para>
> +
>    <para>
>     <example>
> +    <title>
> +     &null; <parameter>callback</parameter> with only
> +     <parameter>array1</parameter>
>

This example demonstrates the same behaviour shown in the "array_map() -
with string keys" example below it, which also shows the original array
being returned unchanged.

+    </title>
> +    <programlisting role="php">
> +<![CDATA[
> +<?php
> +$array = [1, 2, 3];
> +var_dump(array_map(null, $array));
> +?>
> +]]>
> +    </programlisting>
> +    &example.outputs;
> +    <screen>
> +<![CDATA[
> +array(3) {
> +  [0]=>
> +  int(1)
> +  [1]=>
> +  int(2)
> +  [2]=>
> +  int(3)
> +}
> +]]>
> +    </screen>
> +   </example>
> +  </para>
> +  <para>
> +   <example>
>      <title><function>array_map</function> - with string keys</title>
>      <programlisting role="php">
>  <![CDATA[
>
>
> --
> PHP Documentation Commits Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic