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-change-key-case.xml
Mengkang Zhou 5a11fc9fc3 updated by zhoumengkang
git-svn-id: https://svn.php.net/repository/phpdoc/zh/trunk@333630 c90b9560-bf6c-de11-be94-00142212c4b1
2014-05-30 10:02:02 +00:00

124 lines
3.4 KiB
XML
Executable File

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 96c9d88bad9a7d7d44bfb7f26c226df7ee9ddf26 Maintainer: HonestQiao Status: ready -->
<!-- Reviewed: no Maintainer: HonestQiao -->
<refentry xml:id="function.array-change-key-case" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>array_change_key_case</refname>
<refpurpose>返回字符串键名全为小写或大写的数组</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>array_change_key_case</methodname>
<methodparam><type>array</type><parameter>input</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>case</parameter><initializer>CASE_LOWER</initializer></methodparam>
</methodsynopsis>
<para>
<function>array_change_key_case</function><parameter>input</parameter>
数组中的所有键名改为全小写或大写。改变是根据后一个选项 <parameter>case</parameter>
参数来进行的。本函数不改变数字索引。
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>input</parameter></term>
<listitem>
<para>
需要操作的数组。
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>case</parameter></term>
<listitem>
<para>
可以在这里用两个常量,<constant>CASE_UPPER</constant>
<constant>CASE_LOWER</constant>(默认值)。
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
返回一个键全是小写或者全是大写的数组;如果输入值(<parameter>input</parameter>)不是一个数组,那么返回&false;
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
如果输入值(<parameter>input</parameter>)不是一个数组,就会抛出一个错误警告(<constant>E_WARNING</constant>)。
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example xml:id="function.array-change-key-case.example-1">
<title><function>array_change_key_case</function>例一</title>
<programlisting role="php">
<![CDATA[
<?php
$input_array = array("FirSt" => 1, "SecOnd" => 4);
print_r(array_change_key_case($input_array, CASE_UPPER));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Array
(
[FIRST] => 1
[SECOND] => 4
)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<para>
如果一个数组中的多个键名经过本函数后变成一样的话(例如
"<literal>keY</literal>" 和 "<literal>kEY</literal>"),最后一个值将覆盖其它的值。
</para>
</note>
</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:"~/.phpdoc/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
-->