📄 function.array-change-key-case.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Changes all keys in an array</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.array.html">Array Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.array-chunk.html">array_chunk</a></div> <div class="up"><a href="ref.array.html">Array Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.array-change-key-case" class="refentry"> <div class="refnamediv"> <h1 class="refname">array_change_key_case</h1> <p class="verinfo">(PHP 4 >= 4.2.0, PHP 5)</p><p class="refpurpose"><span class="refname">array_change_key_case</span> — <span class="dc-title">Changes all keys in an array</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">array</span> <span class="methodname"><b><b>array_change_key_case</b></b></span> ( <span class="methodparam"><span class="type">array</span> <tt class="parameter">$input</tt></span> [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$case</tt></span> ] )</div> <p class="para rdfs-comment"> Returns an array with all keys from <i><tt class="parameter">input</tt></i> lowercased or uppercased. Numbered indices are left as is. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">input</tt></i></span> <dd> <p class="para"> The array to work on </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">case</tt></i></span> <dd> <p class="para"> Either <b><tt>CASE_UPPER</tt></b> or <b><tt>CASE_LOWER</tt></b> (default) </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns an array with its keys lower or uppercased, or false if <i><tt class="parameter">input</tt></i> is not an array. </p> </div> <div class="refsect1 errors"> <h3 class="title">Errors/Exceptions</h3> <p class="para"> Throws <b><tt>E_WARNING</tt></b> if <i><tt class="parameter">input</tt></i> is not an array. </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="function.array-change-key-case.example-1" name="function.array-change-key-case.example-1"> <p><b>Example #1 <b>array_change_key_case()</b> example</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br />$input_array </span><span style="color: #007700">= array(</span><span style="color: #DD0000">"FirSt" </span><span style="color: #007700">=> </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #DD0000">"SecOnd" </span><span style="color: #007700">=> </span><span style="color: #0000BB">4</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">array_change_key_case</span><span style="color: #007700">(</span><span style="color: #0000BB">$input_array</span><span style="color: #007700">, </span><span style="color: #0000BB">CASE_UPPER</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> <div class="example-contents"><p>The above example will output:</p></div> <div class="example-contents"><pre><div class="cdata"><pre>Array( [FIRST] => 1 [SECOND] => 4)</pre></div> </pre></div> </div> </p> </div> <div class="refsect1 notes"> <h3 class="title">Notes</h3> <blockquote><p><b class="note">Note</b>: If an array has indices that will be the same once run through this function (e.g. "keY" and "kEY"), the value that is later in the array will override other indices. <br /> </p></blockquote> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.array.html">Array Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.array-chunk.html">array_chunk</a></div> <div class="up"><a href="ref.array.html">Array Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -