1
0
mirror of https://github.com/php/doc-zh.git synced 2026-03-26 08:02:16 +01:00
Files
archived-doc-zh/reference/array/functions/array-pad.xml
Dallas Wang 877f5fa4fc Translation completed.
git-svn-id: https://svn.php.net/repository/phpdoc/zh/trunk@95317 c90b9560-bf6c-de11-be94-00142212c4b1
2002-09-09 21:00:24 +00:00

71 lines
2.0 KiB
XML
Executable File

<?xml version="1.0" encoding="gb2312"?>
<!-- $Revision: 1.1 $ -->
<!-- $Author: dallas $ -->
<!-- EN-Revision: 1.4 Maintainer: dallas Status: ready -->
<refentry id="function.array-pad">
<refnamediv>
<refname>array_pad</refname>
<refpurpose>
用值将数组填补到指定长度
</refpurpose>
</refnamediv>
<refsect1>
<title>说明</title>
<methodsynopsis>
<type>array</type><methodname>array_pad</methodname>
<methodparam><type>array</type><parameter>input</parameter></methodparam>
<methodparam><type>int</type><parameter>pad_size</parameter></methodparam>
<methodparam><type>mixed</type><parameter>pad_value</parameter></methodparam>
</methodsynopsis>
<para>
<function>array_pad</function> 返回
<parameter>input</parameter> 的一个拷贝,并用
<parameter>pad_value</parameter> 将其填补到
<parameter>pad_size</parameter> 指定的长度。如果
<parameter>pad_size</parameter> 为正,则数组被填补到右侧,如果为负则从左侧开始填补。如果
<parameter>pad_size</parameter> 的绝对值小于或等于
<parameter>input</parameter> 数组的长度则没有任何填补。
</para>
<para>
<example>
<title><function>array_pad</function> 例子</title>
<programlisting role="php">
<![CDATA[
$input = array (12, 10, 9);
$result = array_pad ($input, 5, 0);
// result is array (12, 10, 9, 0, 0)
$result = array_pad ($input, -7, -1);
// result is array (-1, -1, -1, -1, 12, 10, 9)
$result = array_pad ($input, 2, "noop");
// not padded
]]>
</programlisting>
</example>
</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
-->