#9441 [Com]: New feature for foreach control structure

From: Date: Fri, 02 Aug 2002 13:21:51 +0000
Subject: #9441 [Com]: New feature for foreach control structure
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-15818@lists.php.net to get a copy of this message
ID: 9441 Comment by: parham_m_s@hotmail.com Reported By: php@leon.brooks.fdns.net Status: Open Bug Type: Feature/Change Request Operating System: (all, using) Linux 2.2.18 PHP Version: 4.0.4pl1 New Comment: i recently converted from perl to php and this was the first thing i realized. The foreach construct should be implemented into files because it's just eyepleasing (and easier) for some people. The same idea should also be applied to opendir (or even dumping an entire directory tree into an array). Previous Comments: ------------------------------------------------------------------------ [2001-02-25 09:02:14] php@leon.brooks.fdns.net Would find it convenient to do this: $filehandle=fopen("file","r"); foreach ($filehandle as $line) { # process line (line ends stripped off) } fclose ($filehandle); ...and even this... $filehandle=fopen("file","r"); foreach ($filehandle as $line[]) { # $line[0] = whole line sans ends # $line[1] = first word (exploded out gawk-like) # $line[2] = second word, etc } fclose ($filehandle); ...just a thought. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=9441&edit=1

« previous php.bugs (#15818) next »