note 59659 rejected from function.fgets by nlopess
| From: | nlopess@php.net | Date: | Tue, 20 Dec 2005 14:39:51 +0000 |
| Subject: | note 59659 rejected from function.fgets by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-100470@lists.php.net to get a copy of this message | ||
Note Submitter: r_karthikeyan83 at yahoo dot co dot in
----
When I get string from a file and I created directories with that strings dynamically at the run
time, then that directories became invalid. Codes are as below,
/* inputfile.txt contains */
tst1
tst2
tst3
<?
$handle = fopen("inputfile.txt", "r");
if ($handle) {
while (!feof($handle)) {
$dir_name = fgets($handle, 4096);
mkdir($dir_name, 0777);
}
fclose($handle);
}
?>
But if I create directories stored in array it is valid, code is as given below,
<?
$chk[]="tst1";
$chk[]="tst2";
$chk[]="tst3";
$i=0;
for($i=0;$i<count($chk);$i++)
{
mkdir($chk[$i], 0777);
}
?>
What is the reason? Please reply me the answer.