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
https://forums.phpfreaks.com/topic/14156-php-tool-by-me-d/
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
https://forums.phpfreaks.com/topic/14156-php-tool-by-me-d/#findComment-55731
Share on other sites

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.