Re: [PHP] new line function
On Thu, 02 Sep 2004 01:08:20 -0400, John Holmes [EMAIL PROTECTED] wrote: Curt Zirzow wrote: $fixed = preg_replace(/(\r?\n)|\r/,'br /',$oldstring); on retrosopect.. reading into that regex i get: unix: sets the standard to use \n windows: can't really decide on \r or \n so just uses them both mac: goes oposite of everybody and used \r instead. It seems OS's can simply be described on how they treat EOL, all the rest of the differences are side effects of this behaviour. Yeah, of course... Think of how secure windows would be if they just used \n! ;) It certainly could be more stable. I've seen badly coded programs which ignore that the line terminator is two bytes and try to stick strings in blocks of mem one byte too small as a result. Its not common, but every little thing has an effect :P -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] new line function
hi, is there any function to replace \n to br that we can see the results in html source code (not in preview)? i tried nl2br, str_replace, and ereg_replace. but all of them work just in page preview. when i looked in page source, the strings remain the same. here i enclose strings i got in page source... original: this is the first line and this is the second this is the third using nl2br function: this is the first linebr \ and this is the secondbr \ this is the third my expectation: this is the first linebr \and this is the secondbr \this is the third i need this cause i'll send this string with javascript. if i used nl2br, i got message in javascript console like this: Error: unterminated string literal update(this is the first linebr \ :-( thanx -- Dominus Tecum -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] new line function
Tonny Robertus wrote: is there any function to replace \n to br that we can see the results in html source code (not in preview)? $fixed = preg_replace(/(\r?\n)|\r/,'br /',$oldstring); -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] new line function
* Thus wrote John Holmes: Tonny Robertus wrote: is there any function to replace \n to br that we can see the results in html source code (not in preview)? $fixed = preg_replace(/(\r?\n)|\r/,'br /',$oldstring); again.. your the master of perfection :) unix, dos, mac.. no matter, it still works! Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] new line function
* Thus wrote Curt Zirzow: * Thus wrote John Holmes: Tonny Robertus wrote: is there any function to replace \n to br that we can see the results in html source code (not in preview)? $fixed = preg_replace(/(\r?\n)|\r/,'br /',$oldstring); on retrosopect.. reading into that regex i get: unix: sets the standard to use \n windows: can't really decide on \r or \n so just uses them both mac: goes oposite of everybody and used \r instead. It seems OS's can simply be described on how they treat EOL, all the rest of the differences are side effects of this behaviour. :) Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] new line function
Curt Zirzow wrote: $fixed = preg_replace(/(\r?\n)|\r/,'br /',$oldstring); on retrosopect.. reading into that regex i get: unix: sets the standard to use \n windows: can't really decide on \r or \n so just uses them both mac: goes oposite of everybody and used \r instead. It seems OS's can simply be described on how they treat EOL, all the rest of the differences are side effects of this behaviour. Yeah, of course... Think of how secure windows would be if they just used \n! ;) -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php