cvs: /phpdoc/functions array.sgml

From: Date: Fri, 16 Jul 1999 15:06:21 +0000
Subject: cvs: /phpdoc/functions array.sgml
Groups: php.dev 
Request: Send a blank email to php-dev+get-8612@lists.php.net to get a copy of this message
andrey Fri Jul 16 15:06:21 1999 EDT Modified files: /phpdoc/functions array.sgml Log: Added version notes and documented array_slice. Index: phpdoc/functions/array.sgml diff -u phpdoc/functions/array.sgml:1.5 phpdoc/functions/array.sgml:1.6 --- phpdoc/functions/array.sgml:1.5 Fri Jul 16 13:05:14 1999 +++ phpdoc/functions/array.sgml Fri Jul 16 15:06:21 1999 @@ -90,6 +90,11 @@ See also <function>array_pop</function>, <function>array_shift</function>, and <function>array_unshift</function>. + + <note> + <para> + This function was added in PHP 4.0. + </note> </refsect1> </refentry> @@ -125,6 +130,11 @@ See also <function>array_push</function>, <function>array_shift</function>, and <function>array_unshift</function>. + + <note> + <para> + This function was added in PHP 4.0. + </note> </refsect1> </refentry> @@ -170,6 +180,11 @@ See also <function>array_shift</function>, <function>array_push</function>, and <function>array_pop</function>. + + <note> + <para> + This function was added in PHP 4.0. + </note> </refsect1> </refentry> @@ -201,6 +216,72 @@ </example> This would result in $args having one element "-f" left, and $opt being "-v". + + <para> + See also <function>array_unshift</function>, + <function>array_push</function>, and + <function>array_pop</function>. + + <note> + <para> + This function was added in PHP 4.0. + </note> + </refsect1> + </refentry> + + <refentry id="function.array-slice"> + <refnamediv> + <refname>array_slice</refname> + <refpurpose>Extract a slice of the array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcdef>array <function>array_slice</function></funcdef> + <paramdef>array <parameter>array</parameter></paramdef> + <paramdef>int <parameter>offset</parameter></paramdef> + <paramdef>int + <parameter><optional>length</optional></parameter></paramdef> + </funcsynopsis> + + <para> + <function>array_slice</function> returns a sequence of elements from the <parameter>array</parameter> specified by the <parameter>offset</parameter> and <parameter>length</parameter> parameters. + + <para> + If <parameter>offset</parameter> is positive, the sequence will + start at that offset in the <parameter>array</parameter>. If + <parameter>offset</parameter> is negative, the sequence will + start at that offset from the end of the + <parameter>array</parameter>. + + <para> + If <parameter>length</parameter> is given and is positive, then + the sequence will have that many elements in it. If + <parameter>length</parameter> is given and is negative or if it + is omitted, then the sequence will have everything from + <parameter>offset</parameter> and up until the end of the + <parameter>array</parameter>. + + <para> + <example> + <title><function>array_slice</function> examples</title> + <programlisting> +$input = array("a", "b", "c", "d", "e"); + +$output = array_slice($input, 2); // returns "c", "d", and "e" +$output = array_slice($input, 2, -1); // returns "c", "d", and "e" +$output = array_slice($input, -2, 1); // returns "d" +$output = array_slice($input, 0, 3); // returns "a", "b", and "c" + </programlisting> + </example> + + <para> + See also <function>array_splice</function>. + + <note> + <para> + This function was added in PHP 4.0. + </note> </refsect1> </refentry>

« previous php.dev (#8612) next »