Re: [PHP] How to add a carriage return in the end when using implode?
On Tuesday 08 January 2002 14:18, Zhang, Leon (STHK/Zh) wrote: $subdata has been changed before then $data[$index]=implode(,, $subdata); --what should I change here ? rewrite the file like this : $data[$index]=$data[$index]; $fp=fopen($datafile,w+); $a=0; do{ fputs($fp,$data[$a]);--or here?. $a++; }while($acount($data)); fclose($fp); however if one line of the $datab has been implode with $subdata ,there will not be a 'return' in the final text file , this line just is joined with the next line ,what should I do here to add the $data as a single line? Not sure if I understand you correctly. If you just want to add a newline character then you can try this: $data[$index]=implode(,, $subdata) . \n; hth -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* BASIC is the Computer Science equivalent of `Scientific Creationism'. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
re: [PHP] How to add a carriage return in the end when using implode?
Yes,I have just worked out ,thank you Jason. -原始邮件- 发件人: Jason Wong [mailto:[EMAIL PROTECTED]] 发送时间: 08 January, 2002 16:46 收件人: [EMAIL PROTECTED] 主题: Re: [PHP] How to add a carriage return in the end when using implode? On Tuesday 08 January 2002 14:18, Zhang, Leon (STHK/Zh) wrote: $subdata has been changed before then $data[$index]=implode(,, $subdata); --what should I change here ? rewrite the file like this : $data[$index]=$data[$index]; $fp=fopen($datafile,w+); $a=0; do{ fputs($fp,$data[$a]);--or here?. $a++; }while($acount($data)); fclose($fp); however if one line of the $datab has been implode with $subdata ,there will not be a 'return' in the final text file , this line just is joined with the next line ,what should I do here to add the $data as a single line? Not sure if I understand you correctly. If you just want to add a newline character then you can try this: $data[$index]=implode(,, $subdata) . \n; hth -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* BASIC is the Computer Science equivalent of `Scientific Creationism'. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] How to add a carriage return in the end when using implode?
$subdata has been changed before then $data[$index]=implode(",", $subdata);--what shouldI change here? rewrite the file like this : $data[$index]=$data[$index];$fp=fopen($datafile,"w+"); $a=0; do{ fputs($fp,$data[$a]);--or here?. $a++; }while($acount($data));fclose($fp); however if one line of the $datab has been implode with $subdata ,there will not be a 'return' in the final text file , this line just is joined with the next line ,what should I do here to add the $data as a single line? Thanks Leon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]