Page 1 of 1
character Tab in php and C++
Posted: Sat Jul 23, 2005 11:24 am
by php12342005
I am wondering if such characters can be used in php, which can be used in C++:
characters:
Tab: \t
Line break: \n
etc.
I have to use <br> for \n (it works).
But what TAG or something are similar to \t in php?
\t is useful for displaying (echo or print) text nicer.
thanks
Posted: Sat Jul 23, 2005 11:28 am
by Chris Corbyn
Those characters work in any language where you are outputting ascii code.
So yes they work. You dont have to use <br> for \n...
Don't forget what PHP does

It outputs the HTML source code so thats where your tabs and linebreaks are...
A tab in HTML if that's what you're asking, is 	
Posted: Sat Jul 23, 2005 11:39 am
by php12342005
Hi,
I tested your comment:
add php code:
-----------------------------
print("hello			\n");
print("hello			\n");
output is
-----------------
hello hello
You see, only one space character between 2 "hello"s
I think the space char is "\n" rather than Tab
so it looks Tab (	) doesn't work.
Posted: Sat Jul 23, 2005 11:52 am
by nielsene
php12342005 wrote:Hi,
I tested your comment:
add php code:
-----------------------------
print("hello			\n");
print("hello			\n");
output is
-----------------
hello hello
You see, only one space character between 2 "hello"s
I think the space char is "\n" rather than Tab
so it looks Tab (	) doesn't work.
you need the semi-colon 	
; to terminate an "html entity reference".
Posted: Sat Jul 23, 2005 11:54 am
by Chris Corbyn
You're missing your semi-colons after 	
It is the correct and documented ascii code for it
&ht; (horizontal tab) may also work but I'd recommend going with numbered entities for that sort of thing.
Is there a reason you really must use tab? You can use multiple times OR lay your data out in tables or with CSS for the best control over presentation.
Posted: Sat Jul 23, 2005 11:59 am
by php12342005
is code this way?
print("hello \n");
print("hello \n");
but output is the same.
(	 with a semi-colon can not be desplayed)
Posted: Sat Jul 23, 2005 12:02 pm
by Chris Corbyn
I wouldn't work up a sweat over it. It's not something that's commonly used in presentation and perhaps not supported on some browsers (I think there's only 3 ascii chars in the range 0-31 or something which are actually allowed in HTML).
Try using or doing the proper thing and using CSS or tables

Posted: Sat Jul 23, 2005 12:34 pm
by nielsene
php12342005 wrote:is code this way?
print("hello \n");
print("hello \n");
but output is the same.
(	 with a semi-colon can not be desplayed)
Are you viewing the output on a browser? in the 'view source" of a browser, or on the command-line?