mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 17:08:54 +00:00
Added examples of implementations of array_keys and array_values for PHP3 users
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@32274 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
c0c98e95c2
commit
342f5abda0
1 changed files with 40 additions and 0 deletions
|
@ -249,6 +249,26 @@ array_keys ($array, "blue"); // returns array (0, 3, 4)
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
This function was added to PHP4, below is an implementation for
|
||||
those still using PHP3.
|
||||
<example>
|
||||
<title>
|
||||
Implementation of <function>array_keys</function> for
|
||||
PHP3 users
|
||||
</title>
|
||||
<programlisting role="php">
|
||||
function array_keys($arr) {
|
||||
$t = array();
|
||||
while (list($k,$v) = each($arr))
|
||||
$t[] = $k;
|
||||
return $t;
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
See also <function>array_values</function>.
|
||||
</para>
|
||||
|
@ -1004,6 +1024,26 @@ array_values ($array); // returns array ("XL", "gold")
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
This function was added to PHP4, below is an implementation for
|
||||
those still using PHP3.
|
||||
<example>
|
||||
<title>
|
||||
Implementation of <function>array_values</function> for
|
||||
PHP3 users
|
||||
</title>
|
||||
<programlisting role="php">
|
||||
function array_values($arr) {
|
||||
$t = array();
|
||||
while (list($k,$v) = each($arr))
|
||||
$t[] = $v;
|
||||
return $t;
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
Loading…
Reference in a new issue