Jump to content

PHP Tool By me :D


Chirantha

Recommended Posts

Hi,

I'm a person that is lazy to indent my code.. Then when I find a bug I have a horrible time finding it :(. So I wrote a PHP script that indents code. Well it works to some extent but it isn't perfect.

Make sure you use the { and } so it won't mess up. Its a bit high on the CPU. As its still not perfect there will be some bugs. But a basic code can be indented.

The script is currently hosted on my Computer. And my computer is online from 12PM - 2AM (+5.5GMT). I don't have a good connection as well :(.

This script can make :

[code]for (i=0; i<string_length(string1) i+=1) {
if (string_char_at(string1,i)="s")
{
do=1;
for (a=0; a<data1; a+=1)
{
stop[i]=1;
x=0;
y=78;
images_angle=4;
for (b=d_id; b<d_id+100; b+=1)
{
string_delete(main,1,1)
}
}
}
}
[/code]

To this :

[code]for (i=0; i<string_length(string1) i+=1) {
    if (string_char_at(string1,i)="s")
    {
        do=1;
        for (a=0; a<data1; a+=1)
        {
            stop[i]=1;
            x=0;
            y=78;
            images_angle=4;
            for (b=d_id; b<d_id+100; b+=1)
            {
                string_delete(main,1,1)
            }
        }
    }
}[/code]

Also make sure you code doesn't look like this :

[code]if (this) {
do this
and
this}[/code]

[code]if (this)
do_this()
echo "echo"; [/code]

Make sure its like this :

[code]if (this) {
do this
and
this
}[/code]

[code]if (this) {
do_this()
}
echo "echo"; [/code]

link is : http://csoft-p.no-ip.info/string.php

Thank you,
Chirantha
Link to comment
Share on other sites

just out of curiosity.. if i had to take the trouble to format my script a certain way, in order for it to be converted to another format..why not just type it right in the first place?

and personally, i find that properly indenting in the first place helps reduce the bugs you'd be looking for later on.

Link to comment
Share on other sites

  • 1 month later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.