note 59659 added to function.fgets

From: Date: Mon, 12 Dec 2005 20:01:10 +0000
Subject: note 59659 added to function.fgets
Groups: php.notes 
Request: Send a blank email to php-notes+get-100020@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.fgets.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+59659 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59659&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59659&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59659&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59659&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59659&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59659&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59659&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+59659&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#100020) next »