[PHP] line break part2
Thanks for everyone's help on the original question. Now that I have gotten the line breaks in a file, How do I get the file out with the breaks? Also, does anyone know of a good tutorial on file formatting. ?php $location = log_test.txt; $toread = fopen($location, r); set_magic_quotes_runtime(0); $content = fread($toread, filesize($location)); fclose($toread); echo $content; ? TIA Gary -- 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] line break part2
just do $content_str = implode(\n, $content); at the end of the file. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -Original Message- From: Gary [mailto:[EMAIL PROTECTED]] Sent: Saturday, April 28, 2001 2:54 AM To: [EMAIL PROTECTED] Subject: [PHP] line break part2 Thanks for everyone's help on the original question. Now that I have gotten the line breaks in a file, How do I get the file out with the breaks? Also, does anyone know of a good tutorial on file formatting. ?php $location = log_test.txt; $toread = fopen($location, r); set_magic_quotes_runtime(0); $content = fread($toread, filesize($location)); fclose($toread); echo $content; ? TIA Gary -- 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]
Re: [PHP] line break part2
Have a look at file() : http://www.php.net/manual/en/function.file.php $lines = file('log_test.txt'); echo $lines[4]; // prints line #5 regards, philip On Fri, 27 Apr 2001, Gary wrote: Thanks for everyone's help on the original question. Now that I have gotten the line breaks in a file, How do I get the file out with the breaks? Also, does anyone know of a good tutorial on file formatting. ?php $location = log_test.txt; $toread = fopen($location, r); set_magic_quotes_runtime(0); $content = fread($toread, filesize($location)); fclose($toread); echo $content; ? TIA Gary -- 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]
Re: [PHP] line break part2
$string = nl2br($string) This will change a new line into br; but make sure HTMLspecialchars aren't in the same part. -- 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]