2010-03-28 22:10:10 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 06:30:45 +00:00
|
|
|
<!-- $Revision$ -->
|
2007-06-20 22:25:43 +00:00
|
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.array-pop">
|
2006-10-31 11:24:02 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>array_pop</refname>
|
|
|
|
<refpurpose>Pop the element off the end of array</refpurpose>
|
|
|
|
</refnamediv>
|
2007-06-18 22:49:15 +00:00
|
|
|
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2006-10-31 11:24:02 +00:00
|
|
|
<methodsynopsis>
|
|
|
|
<type>mixed</type><methodname>array_pop</methodname>
|
|
|
|
<methodparam><type>array</type><parameter role="reference">array</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
2018-08-02 22:15:32 +00:00
|
|
|
<function>array_pop</function> pops and returns the value of
|
|
|
|
the last element of <parameter>array</parameter>, shortening the
|
2006-10-31 11:24:02 +00:00
|
|
|
<parameter>array</parameter> by one element.
|
|
|
|
</para>
|
|
|
|
&array.resetspointer;
|
2007-06-18 22:49:15 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>array</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The array to get the value from.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
2018-08-02 22:15:32 +00:00
|
|
|
Returns the value of the last element of <parameter>array</parameter>.
|
2007-06-18 22:49:15 +00:00
|
|
|
If <parameter>array</parameter> is empty (or is not an array),
|
|
|
|
&null; will be returned.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
2006-10-31 11:24:02 +00:00
|
|
|
|
2014-11-30 06:21:53 +00:00
|
|
|
<refsect1 role="errors">
|
|
|
|
&reftitle.errors;
|
|
|
|
<para>
|
|
|
|
This function will produce an error of level <link linkend="errorfunc.constants">
|
|
|
|
E_WARNING</link> when called on a non-array.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
2007-06-18 22:49:15 +00:00
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
2006-10-31 11:24:02 +00:00
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title><function>array_pop</function> example</title>
|
|
|
|
<programlisting role="php">
|
2002-04-15 00:12:54 +00:00
|
|
|
<![CDATA[
|
2003-02-05 07:20:39 +00:00
|
|
|
<?php
|
2003-08-17 12:21:03 +00:00
|
|
|
$stack = array("orange", "banana", "apple", "raspberry");
|
|
|
|
$fruit = array_pop($stack);
|
2003-02-05 07:20:39 +00:00
|
|
|
print_r($stack);
|
|
|
|
?>
|
2002-04-15 00:12:54 +00:00
|
|
|
]]>
|
2006-10-31 11:24:02 +00:00
|
|
|
</programlisting>
|
|
|
|
<para>
|
|
|
|
After this, <varname>$stack</varname> will have only 3 elements:
|
|
|
|
</para>
|
|
|
|
<screen role="php">
|
2002-04-15 00:12:54 +00:00
|
|
|
<![CDATA[
|
|
|
|
Array
|
|
|
|
(
|
|
|
|
[0] => orange
|
|
|
|
[1] => banana
|
|
|
|
[2] => apple
|
|
|
|
)
|
|
|
|
]]>
|
2006-10-31 11:24:02 +00:00
|
|
|
</screen>
|
2002-04-15 00:12:54 +00:00
|
|
|
<para>
|
2006-10-31 11:24:02 +00:00
|
|
|
and <literal>raspberry</literal> will be assigned to
|
|
|
|
<varname>$fruit</varname>.
|
2002-04-15 00:12:54 +00:00
|
|
|
</para>
|
2006-10-31 11:24:02 +00:00
|
|
|
</example>
|
|
|
|
</para>
|
2007-06-18 22:49:15 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
2006-10-31 11:24:02 +00:00
|
|
|
<para>
|
2008-12-14 14:51:22 +00:00
|
|
|
<simplelist>
|
|
|
|
<member><function>array_push</function></member>
|
|
|
|
<member><function>array_shift</function></member>
|
|
|
|
<member><function>array_unshift</function></member>
|
|
|
|
</simplelist>
|
2006-10-31 11:24:02 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
2002-04-15 00:12:54 +00:00
|
|
|
|
|
|
|
<!-- 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
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2002-04-15 00:12:54 +00:00
|
|
|
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
|
|
|
|
-->
|