RE: [PHP] foreach $_FILES

From: Date: Wed, 14 Dec 2005 14:34:06 +0000
Subject: RE: [PHP] foreach $_FILES
Groups: php.general 
Request: Send a blank email to php-general+get-227417@lists.php.net to get a copy of this message
[snip] However if I loop through the $_FILES array like this: foreach( $_FILES as $key => $value ){ echo '$key = '.$key.'<br />'; echo '$value = '.$value.'<br />'; } $key = File_1_CSV $value['name'] = File_1.CSV $key = File_2_CSV $value['name'] = File_2.CSV The . is replaced with an underscore in the $key value. I could get around this with a substr() but it seems a little inelegant, can anyone tell me why this is happening please? [/snip] Periods are not allowed in variable names and are replaced by an underscore. You could use regex to do the replacement so that you can do comparison.

« previous php.general (#227417) next »