mirror of
https://github.com/php/doc-ja.git
synced 2026-03-25 23:52:16 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@134668 c90b9560-bf6c-de11-be94-00142212c4b1
81 lines
2.1 KiB
XML
81 lines
2.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- sync: 1.8 -->
|
|
<refentry id="function.array-shift">
|
|
<refnamediv>
|
|
<refname>array_shift</refname>
|
|
<refpurpose>配列の先頭から要素を一つ取り出す</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>説明</title>
|
|
<methodsynopsis>
|
|
<type>mixed</type><methodname>array_shift</methodname>
|
|
<methodparam><type>array</type><parameter>array</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>array_shift</function>は、<parameter>array</parameter>
|
|
の最初の値を取り出して返します。配列 <parameter>array</parameter>
|
|
は、要素一つ分だけ短くなり、全ての要素は前にずれます。
|
|
<parameter>array</parameter> が空の場合(または配列でない場合)、
|
|
&null;が返されます。
|
|
</para>
|
|
|
|
&array.resetspointer;
|
|
|
|
<example>
|
|
<title><function>array_shift</function> の例</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$stack = array ("orange", "banana", "apple", "raspberry");
|
|
$fruit = array_shift ($stack);
|
|
print_r($stack);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
<para>
|
|
<varname>$stack</varname>には3つの要素が残されます:
|
|
</para>
|
|
<screen role="php">
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[0] => banana
|
|
[1] => apple
|
|
[2] => raspberry
|
|
)
|
|
]]>
|
|
</screen>
|
|
<para>
|
|
そして<varname>$fruit</varname>に<literal>orange</literal>が
|
|
割り当てられます。
|
|
</para>
|
|
</example>
|
|
<para>
|
|
<function>array_unshift</function>,
|
|
<function>array_push</function>,
|
|
<function>array_pop</function>も参照してください。
|
|
</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:"../../../../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
|
|
-->
|