⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function.array-pop.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Pop the element off the end of array</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.array-pad.html">array_pad</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.array-product.html">array_product</a></div> <div class="up"><a href="ref.array.html">Array Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.array-pop" class="refentry"> <div class="refnamediv">  <h1 class="refname">array_pop</h1>  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">array_pop</span> &mdash; <span class="dc-title">Pop the element off the end of array</span></p> </div>  <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><b><b>array_pop</b></b></span>    ( <span class="methodparam"><span class="type">array</span> <tt class="parameter reference">&$array</tt></span>   )</div>  <p class="para rdfs-comment">   <b>array_pop()</b> pops and returns the last value of   the <i><tt class="parameter">array</tt></i>, shortening the   <i><tt class="parameter">array</tt></i> by one element.   If <i><tt class="parameter">array</tt></i> is empty (or is not an array),   <b><tt>NULL</tt></b> will be returned. Will additionally produce a   <a href="errorfunc.constants.html#errorfunc.constants.errorlevels.e-warning" class="link">Warning</a>   when called on a non-array.  </p>  <blockquote><p><b class="note">Note</b>: <span class="simpara">This function will <a href="function.reset.html" class="function">reset()</a> the <a href="language.types.array.html" class="type array">array</a> pointer after use.</span></p></blockquote> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">array</tt></i></span>     <dd>      <p class="para">       The array to get the value from.      </p>     </dd>    </dt>   </dl>  </p> </div> <div class="refsect1 returnvalues">  <h3 class="title">Return Values</h3>  <p class="para">   Returns the last value of <i><tt class="parameter">array</tt></i>.   If <i><tt class="parameter">array</tt></i> is empty (or is not an array),   <b><tt>NULL</tt></b> will be returned.  </p> </div> <div class="refsect1 examples">  <h3 class="title">Examples</h3>  <p class="para">   <div class="example">    <p><b>Example #1 <b>array_pop()</b> example</b></p>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$stack&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">"orange"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"banana"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"apple"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"raspberry"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$fruit&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">array_pop</span><span style="color: #007700">(</span><span style="color: #0000BB">$stack</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$stack</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>    <div class="example-contents"><p>     After this, <var class="varname">$stack</var> will have only 3 elements:    </p></div>    <div class="example-contents"><pre><div class="cdata"><pre>Array(    [0] =&gt; orange    [1] =&gt; banana    [2] =&gt; apple)</pre></div>    </pre></div>    <div class="example-contents"><p>     and <i>raspberry</i> will be assigned to     <var class="varname">$fruit</var>.    </p></div>   </div>  </p> </div> <div class="refsect1 seealso">  <h3 class="title">See Also</h3>  <p class="para">   See also <a href="function.array-push.html" class="function" rel="rdfs-seeAlso">array_push()</a>,   <a href="function.array-shift.html" class="function" rel="rdfs-seeAlso">array_shift()</a>, and   <a href="function.array-unshift.html" class="function" rel="rdfs-seeAlso">array_unshift()</a>.  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.array-pad.html">array_pad</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.array-product.html">array_product</a></div> <div class="up"><a href="ref.array.html">Array Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -