CVS update: php3/doc/functions
| From: | cslawi | Date: | Mon, 07 Sep 1998 10:14:00 +0000 |
| Subject: | CVS update: php3/doc/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-857@lists.php.net to get a copy of this message | ||
Date: Monday September 7, 1998 @ 6:14
Author: cslawi
Update of /repository/php3/doc/functions
In directory asf:/u2/tmp/cvs-serv13534
Modified Files:
array.sgml
Log Message:
Added array_walk().
Fixed a typo.
Index: php3/doc/functions/array.sgml
diff -c php3/doc/functions/array.sgml:1.22 php3/doc/functions/array.sgml:1.23
*** php3/doc/functions/array.sgml:1.22 Wed Jul 29 15:19:50 1998
--- php3/doc/functions/array.sgml Mon Sep 7 06:13:56 1998
***************
*** 47,52 ****
--- 47,112 ----
</refsect1>
</refentry>
+
+ <refentry id="function.array-walk">
+ <refnamediv>
+ <refname>array_walk</refname>
+ <refpurpose>
+ Apply a function to every member of an array.
+ </refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Description</title>
+ <funcsynopsis>
+ <funcdef>int <function>array_walk</function></funcdef>
+ <paramdef>array <parameter>arr</parameter></paramdef>
+ <paramdef>string <parameter>func</parameter></paramdef>
+ </funcsynopsis>
+
+ <simpara>
+ Applies the function named by <parameter>func</parameter> to each
+ element of <parameter>arr</parameter>. The elements are passed as
+ the first argument of <parameter>func</parameter>; if
+ <parameter>func</parameter> requires more than one argument, a
+ warning will be generated each time
+ <function>array_walk</function> calls
+ <parameter>func</parameter>. These warnings may be suppressed by
+ prepending the '@' sign to the <function>array_walk</function>
+ call, or by using <function>error_reporting</function>.
+
+ <para>
+ Note that <parameter>func</parameter> will actually be working
+ with the elements of <parameter>arr</parameter>, so any changes
+ made to those elements will actually be made in the array itself.
+
+ <para>
+ <example>
+ <title><function>array_walk</function> example</title>
+ <programlisting>
+ $fruits =
array("d"=>"lemon","a"=>"orange","b"=>"banana","c"=>"apple");
+
+ function test_alter( $item1 ) {
+ $item1 = 'bogus';
+ }
+
+ function test_print( $item2 ) {
+ echo "$item2<br>\n";
+ }
+
+ array_walk( $fruits, 'test_print' );
+ array_walk( $fruits, 'test_alter' );
+ array_walk( $fruits, 'test_print' );
+ </programlisting>
+ </example>
+
+ <simpara>
+ See also <function>each</function> and <function>list</function>.
+
+ </refsect1>
+ </refentry>
+
+
+
<refentry id="function.arsort">
<refnamediv>
<refname>arsort</refname>
***************
*** 230,236 ****
</itemizedlist>
<programlisting>
! $foo = array( "Robert", => "Bob", "Seppo" => "Sepi"
);
$bar = each( $foo );
</programlisting>
--- 290,296 ----
</itemizedlist>
<programlisting>
! $foo = array( "Robert" => "Bob", "Seppo" => "Sepi"
);
$bar = each( $foo );
</programlisting>
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net