cvs: phpdoc /en/reference/array/functions current.xml
| From: | Felipe Pena | Date: | Sun, 06 Jan 2008 12:30:42 +0000 |
| Subject: | cvs: phpdoc /en/reference/array/functions current.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-997@lists.php.net to get a copy of this message | ||
felipe Sun Jan 6 12:30:42 2008 UTC
Modified files:
/phpdoc/en/reference/array/functions current.xml
Log:
Add information about empty array; add examples (#43760)
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/current.xml?r1=1.14&r2=1.15&diff_format=u
Index: phpdoc/en/reference/array/functions/current.xml
diff -u phpdoc/en/reference/array/functions/current.xml:1.14
phpdoc/en/reference/array/functions/current.xml:1.15
--- phpdoc/en/reference/array/functions/current.xml:1.14 Sun Dec 30 19:17:05 2007
+++ phpdoc/en/reference/array/functions/current.xml Sun Jan 6 12:30:42 2008
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.14 $ -->
+<!-- $Revision: 1.15 $ -->
<refentry xml:id="function.current" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>current</refname>
@@ -38,8 +38,8 @@
The <function>current</function> function simply returns the
value of the array element that's currently being pointed to by the
internal pointer. It does not move the pointer in any way. If the
- internal pointer points beyond the end of the elements list,
- <function>current</function> returns &false;.
+ internal pointer points beyond the end of the elements list or the array is
+ empty, <function>current</function> returns &false;.
</para>
&return.falseproblem;
</refsect1>
@@ -58,6 +58,12 @@
$mode = prev($transport); // $mode = 'foot';
$mode = end($transport); // $mode = 'plane';
$mode = current($transport); // $mode = 'plane';
+
+$arr = array();
+var_dump(current($arr)); // bool(false)
+
+$arr = array(array());
+var_dump(current($arr)); // array(0) { }
?>
]]>
</programlisting>