1
0
mirror of https://github.com/php/doc-ja.git synced 2026-03-26 08:02:15 +01:00
Files
archived-doc-ja/reference/array/functions/array-shift.xml
TAKAGI Masahiro cdfe3e4bbb sync with en.
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@222583 c90b9560-bf6c-de11-be94-00142212c4b1
2006-10-31 13:44:12 +00:00

82 lines
2.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.6 $ -->
<!-- EN-Revision: 1.12 Maintainer: hirokawa Status: ready -->
<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 role="reference">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>
そして <literal>orange</literal>
<varname>$fruit</varname> に代入されます。
</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
-->