GetDotted Domains

Viewing Thread:
"PHP formatter"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Wed 16/03/05 at 09:57
Regular
"Lisan al-Gaib"
Posts: 7,093
Anyone got a link to a formatter? My code tends to get scrappily formateed and I need something to bring it back into line. I've tried [URL]http://formatter.gerbenvv.nl/index.php[/URL] but it causes errors.

Link me a working one, preferably a (free) download? I'm wary about submitting my hard work to an online source.
Wed 16/03/05 at 16:31
Regular
"Lisan al-Gaib"
Posts: 7,093
*Sigh* Ignore. Sr forums destroyed my example.

Try running some of your PHP through the link I posted below. Is it not more easily readable?

I simply don't have the time to reformat my php if I put say for an example put a new if in the function.

.if(blahblahblah) {
...dostuff();
...if(blahblahblah) {
.....dostuff();
.....if(blahblahblah) {
.......dostuff();
.......if(blahblahblah) {
.........dostuff();
.........if(blahblahblah) {
...........dostuff();
...........if(blahblahblah) {
.............dostuff();
...........}
.........}
.......}
.....}
...}
.}

Gets formatted from: -

if (blahblahblah){
...dostuff();
..if (blahblahblah){
.........dostuff();
if (blahblahblah){
...dostuff();
.....if (blahblahblah){
....dostuff();
if (blahblahblah){
..dostuff();
..if (blahblahblah){
dostuff();
.......}
...........}
.}
.....}
}
}
Wed 16/03/05 at 16:27
Regular
"Lisan al-Gaib"
Posts: 7,093
*Sigh* Ignore. Sr forums destroyed my example.

Try running some of your PHP through the link I posted below. Is it not more easily readable?

I simply don't have the time to reformat my php if I put say for an example put a new if in the function.

.if(blahblahblah) {
...dostuff();
...if(blahblahblah) {
.....dostuff();
.....if(blahblahblah) {
.......dostuff();
.......if(blahblahblah) {
.........dostuff();
.........if(blahblahblah) {
...........dostuff();
...........if(blahblahblah) {
.............dostuff();
...........}
.........}
.......}
.....}
...}
.}
Wed 16/03/05 at 15:05
Regular
"Pouch Ape"
Posts: 14,499
Nimco wrote:
> As a result, I use the same format regardless of the size of function
> - same with IF and WHILE statements - always use multiline format.

Yeha, that's exactly what I do.

function run()
{
this++;
that++;
etc--;
}

Never had to do anything with 50+ things to work with though!
Wed 16/03/05 at 13:01
Regular
"NULL"
Posts: 1,384
monkey_man wrote:
> EDIT: I've never understood why people write functions as:
>
> function run() {
> blahblahblah; }
>
> Every tutorial on BASIC, or C I've ever read does it like that, when
> it makes much more sense to keep everything together on one line.

Erm, well think what would happen with a large function.... Many functions can often be in excess of 50 lines - that wouldn't be easy to read on one line!!!

As a result, I use the same format regardless of the size of function - same with IF and WHILE statements - always use multiline format.
Wed 16/03/05 at 12:30
Regular
"Pouch Ape"
Posts: 14,499
I don't think it really matters, as long as it works - it could all be in a straight line as far as assembling or compiling it is concerned. I've stuck by my own little format since the days of QBASIC!

function run()
{ this=20; etc++; }

if(something == somethingelse)
{ dothis(); }

while(something > somethingelse)
{ dothat(); something++; }

Quite simple and uncomplicated, just got to establish where your expressions go, function names, parenthesis, etc. Use a tab/line break combo for nested WHILEs or IFs, but I can't write that down properly here.

EDIT: I've never understood why people write functions as:

function run() {
blahblahblah; }

Every tutorial on BASIC, or C I've ever read does it like that, when it makes much more sense to keep everything together on one line.

EDIT #2: Oh, and I always try to declare variables I'll be using as early as possible in the script. For HTML pages I write everything from the top, and format my strings or open and read data files beforehand then echo the variable, instead of putting PHP angles bracketed tags everywhere:


$this = "blah blah blah";
$that = "blur blur blur";

print("







blah blah blah

$this

$that


");

?>

Hope that's some help for you.
Wed 16/03/05 at 09:57
Regular
"Lisan al-Gaib"
Posts: 7,093
Anyone got a link to a formatter? My code tends to get scrappily formateed and I need something to bring it back into line. I've tried [URL]http://formatter.gerbenvv.nl/index.php[/URL] but it causes errors.

Link me a working one, preferably a (free) download? I'm wary about submitting my hard work to an online source.

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Thanks!
Thank you for dealing with this so promptly it's nice having a service provider that offers a good service, rare to find nowadays.
LOVE it....
You have made it so easy to build & host a website!!!
Gemma

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.