PHP 4.0 Bug #4043 Updated: echo within a while loop causes a parse error
| From: | Bug Database | Date: | Fri, 09 Jun 2000 02:27:50 +0000 |
| Subject: | PHP 4.0 Bug #4043 Updated: echo within a while loop causes a parse error | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-20649@lists.php.net to get a copy of this message | ||
ID: 4043
Updated by: zeev
Reported By: marek@welshdragon.com
Status: Closed
Bug Type: Misbehaving function
Assigned To:
Comments:
echo is a statement and not a function; This means it doesn't return a value, and thus you
can't use it as the while expression.
echo readdir($DH);
shouldn't (and doesn't) yield a parse error.
You can rewrite this code as
while ($dirname=readdir($DH)) {
print $dirname;
}
Full Bug description available at: http://bugs.php.net/version4/?id=4043