
|
View Full Version : How do you indent in PHP?
PCplayground 06-23-2003, 12:07 AM OKay, this is probably a really basic question.
How do you indent in PHP? AKA Tab over. AKA move over five spaces?
This is normal text
This is indented text.
Thanks in advance for any help. :)
The Prohacker 06-23-2003, 12:12 AM My PHP editor does it for me automaticly.. I use Magma editor.. www.phpide.de
harmonic 06-23-2003, 12:26 AM Have you tried hitting tab? I don't get it...
Or do you mean the control for it? it's "\t"
Joe Bonanno 06-23-2003, 12:38 AM Maybe PCplayground is looking for a
coding standard (http://alltasks.net/code/php_coding_standard.html)
Although I am not sure is PHP has an official standard, the above is as near as I could come.
Knogle 06-23-2003, 01:43 AM http://alltasks.net/code/php_coding_standard.html#indent
That seems useful. It says to use 4 spaces instead of a tab.
Darktwist 06-23-2003, 09:24 AM I use EditPlus and it does work very well ;)
PCplayground 06-23-2003, 09:59 AM Well, if I use 4 spaces in a text editor, nothing seems to happen.
Your programs have to be entering in some kind of code when you are tabbing over. Could any of you look at the code and see what it is?
platinum 06-23-2003, 10:57 AM I press the tab key ;)
MGCJerry 06-23-2003, 11:30 AM I tab over by 5 spaces. My editor has a configurable distance when I push the tab key. Then again I code the way I like and that I'm able to read. :)
Adnix 06-23-2003, 12:01 PM Originally posted by PCplayground
Well, if I use 4 spaces in a text editor, nothing seems to happen.
Your programs have to be entering in some kind of code when you are tabbing over. Could any of you look at the code and see what it is?
Not sure what you are asking about... are u asking about "& n b s p ;"? 4 spaces -> "& n b s p ; & n b s p ; & n b s p ; & n b s p ;" (please remove the spaces between the characters)
But then, this is html and has nothing to do with php... so i guess i might have misinterpreted your question...
Lagniappe-labgeek 06-23-2003, 12:04 PM Originally posted by PCplayground
Well, if I use 4 spaces in a text editor, nothing seems to happen.
Your programs have to be entering in some kind of code when you are tabbing over. Could any of you look at the code and see what it is?
Are you talking about on HTML output or the source code itself? If your talking about the html output use
& nbsp; for a no break space (no space between & and nbsp; though
You'd want 4 of them together:
& nbsp;& nbsp;& nbsp;& nbsp;
This will give you 4 spaces together. But that's not a php thing, that's html and the browser's interpretation of it.
If you're talking about indenting the source code in the editor, and you tried tab and spaces, and it won't indent, then it's time to change editors.
If you're looking for the ASCII value for tab it's 9
BTW, I also use EditPlus - cheap, quick, and downloadable user created syntax files for weird stuff I use (like uniVerse).
Adnix 06-23-2003, 12:06 PM :D
PCplayground 06-23-2003, 04:10 PM Originally posted by labgeek
Are you talking about on HTML output or the source code itself? If your talking about the html output use
This will give you 4 spaces together. But that's not a php thing, that's html and the browser's interpretation of it.
If you're talking about indenting the source code in the editor, and you tried tab and spaces, and it won't indent, then it's time to change editors.
If you're looking for the ASCII value for tab it's 9
BTW, I also use EditPlus - cheap, quick, and downloadable user created syntax files for weird stuff I use (like uniVerse).
Thank you very much. :) This is exactly what I wanted to know. by the way, I currently only have a text editor for this, so it was not an editor problem.
Thanks again! :)
MDJ2000 06-24-2003, 08:33 AM For the record, never use just the "Tab" key unless your editor has been set to automatically convert tabs to spaces (preferably indent 4).
Why?, because different systems render tabs differently, it defeats the entire purpose of using proper formatting.
plugged 06-24-2003, 11:21 AM call me crazy, but i feel that 4 spaces is too much, especially for only a 80 char screen.
I use 2 spaces.
MarlboroMan 06-24-2003, 12:44 PM On a related note to the small tangent the thread went off on, when it comes to PHP coding standards, this is what I use:
http://pear.php.net/manual/en/standards.php
|