<?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> <refentry xml:id="function.end" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>end</refname> <refpurpose>Set the internal pointer of an array to its last element</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>mixed</type><methodname>end</methodname> <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> </methodsynopsis> <para> <function>end</function> advances <parameter>array</parameter>'s internal pointer to the last element, and returns its value. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>array</parameter></term> <listitem> <para> The array. This array is passed by reference because it is modified by the function. This means you must pass it a real variable and not a function returning an array because only actual variables may be passed by reference. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns the value of the last element or &false; for empty array. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title><function>end</function> example</title> <programlisting role="php"> <![CDATA[ <?php $fruits = array('apple', 'banana', 'cranberry'); echo end($fruits); // cranberry ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>current</function></member> <member><function>each</function></member> <member><function>prev</function></member> <member><function>reset</function></member> <member><function>next</function></member> <member><function>array_key_last</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"~/.phpdoc/manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->