mirror of
https://github.com/php/doc-ja.git
synced 2026-03-26 16:12:17 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@134671 c90b9560-bf6c-de11-be94-00142212c4b1
82 lines
2.8 KiB
XML
82 lines
2.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- sync: 1.5 -->
|
|
<refentry id="function.array-slice">
|
|
<refnamediv>
|
|
<refname>array_slice</refname>
|
|
<refpurpose>配列の一部を展開する</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>説明</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>array_slice</methodname>
|
|
<methodparam><type>array</type><parameter>array</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>array_slice</function>は、<parameter>array</parameter>
|
|
から引数 <parameter>offset</parameter>および
|
|
<parameter>length</parameter>で指定された連続する要素を返します。
|
|
</para>
|
|
<para>
|
|
<parameter>offset</parameter>が正の場合、要素位置の計算は、
|
|
配列<parameter>array</parameter>のoffsetから始められます。
|
|
<parameter>offset</parameter>が負の場合、要素位置の計算は
|
|
<parameter>array</parameter>の最後から行われます。
|
|
</para>
|
|
<para>
|
|
<parameter>length</parameter>が指定され、正の場合、
|
|
連続する複数の要素が返されます。<parameter>length</parameter>が
|
|
指定され、負の場合、配列の末尾から連続する複数の要素が返されます。
|
|
省略された場合、 <parameter>offset</parameter>から配列の最後まで
|
|
の全ての要素が返されます。
|
|
</para>
|
|
<para>
|
|
<function>array_slice</function>はキーを無視し、
|
|
配列内部の実際の要素の位置を基準にしてオフセットとlengthを
|
|
計算しますので注意してください。
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>array_slice</function>の例</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$input = array ("a", "b", "c", "d", "e");
|
|
|
|
$output = array_slice ($input, 2); // "c", "d", "e"を返します
|
|
$output = array_slice ($input, 2, -1); // "c", "d"を返します
|
|
$output = array_slice ($input, -2, 1); // "d"を返します
|
|
$output = array_slice ($input, 0, 3); // "a", "b", "c"を返します
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<function>array_splice</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
|
|
-->
|