Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > PHP

Reply
 
LinkBack Thread Tools Display Modes
Old 03-16-2003, 11:01 PM   #1 (permalink)
JeC
Registered User
 
JeC's Avatar
 
Join Date: Feb 2003
Location: Australia
Posts: 46
JeC is on a distinguished road
Silly Question: Adding a line break in a string

I want something like

$var1 = $var2."LINEBREAK more text after";

I know the line break in HTML is BR, but I want that line break that shows up in text areas as if you hit ENTER.

Thanks
JeC is offline   Reply With Quote
Old 03-17-2003, 12:29 AM   #2 (permalink)
abc123
bloomberg
 
abc123's Avatar
 
Join Date: Jun 2002
Location: bloomberg
Posts: 263
abc123 is on a distinguished road
Send a message via AIM to abc123 Send a message via Yahoo to abc123
\r
__________________
-- bloomberg.
abc123 is offline   Reply With Quote
Old 03-17-2003, 01:27 AM   #3 (permalink)
JeC
Registered User
 
JeC's Avatar
 
Join Date: Feb 2003
Location: Australia
Posts: 46
JeC is on a distinguished road
Quote:
Originally posted by abc123
\r
You know, I use that with my HTML so much that its no funny.

Thats why I thought it to be a silly question

Thanks! :rock:
JeC is offline   Reply With Quote
Old 03-17-2003, 07:34 AM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,487
sde is on a distinguished road
i always use: \n

i guess one is a 'line feed' and the other is a 'carrage return'

dont' know the exact difference, but i guess they both work.
sde is offline   Reply With Quote
Old 03-17-2003, 10:06 AM   #5 (permalink)
joe_bruin
LOAD "*",8,1
 
Join Date: Feb 2003
Location: la.ca.us
Posts: 254
joe_bruin is on a distinguished road
\n = linefeed
\r = carriage return

text on unix uses \n as the newline separator.
macs use \r
dos/windows uses \r\n (see visual basic's vbCrLf)

it doesn't really matter which one you use (since html ignores them), although traditionally "\n" is used (http uses \n). most text editors are smart enough nowadays to figure out what to do with non-system newline characters, although sometimes you'll come across a dumb one that doesn't, and then you'll see weird boxes or other characters where newlines should be (ex: old versions of notepad).
joe_bruin is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help for another program Androto Standard C, C++ 54 10-15-2004 07:21 AM
From C to Java HighterDK Java 11 07-13-2004 07:15 PM
My game Dodo Standard C, C++ 2 06-27-2004 10:48 AM


All times are GMT -8. The time now is 07:19 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting