Hello Jonathan,
Thanks I know it was something simple like that.

Wednesday, March 5, 2003, 2:42:41 PM, you wrote:


JP> Richard,


JP>   $handle = opendir($emaildir);
JP> $emailes = "";
JP>      while (false !== ($file = readdir($handle))) {
JP>          if ($file != "." && $file != "..") {
JP>                 if ($emailes != "") {                   
JP>                         $emailes .=substr($file,0,strpos($file,'.'));
JP>                 } else {
JP>                         $emailes .= ','. substr($file,0,strpos($file,'.'));
JP>                 }
JP>                   }
JP>      }
JP>      closedir($handle);

JP> That should do it. The if statement takes care of not adding a Comma at 
JP> the first of the string and then the rest of the loop goes through the 
JP> else part of the statement adding in the comma for you.

JP> Hope this helped.

JP> Jonathan Pitcher

JP> On Wednesday, March 5, 2003, at 04:36  PM, Richard Kurth wrote:

>>    The scrip below will list all the files in a directory and also 
>> strip off every
>>    thing in the file name after a .
>>    so if I have files named 1.txt 2.txt 324.txt 5.txt it gives me a 
>> list that
>>    looks like this 123245. I need to add a , in between each of these 
>> file
>>    names so they will look like 1,2,324,5
>>    For some reason I keep looking at this and for the life of me can't
>>    figure out what I need to do.
>>
>>   $handle = opendir($emaildir);
>>     while (false !== ($file = readdir($handle))) {
>>         if ($file != "." && $file != "..") {
>>          $emailes .=substr($file,0,strpos($file,'.'));
>>                  }
>>     }
>>     closedir($handle);
>>
>>
>>
>> -- 
>> Best regards,
>>  Richard                          mailto:[EMAIL PROTECTED]
>>
>>
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>





-- 
Best regards,
 Richard                            mailto:[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to