Any good software to "clean up" PHP code?

Entity

Lifer
Oct 11, 1999
10,090
0
0
I use pico and ultraedit to code, and sometimes I get a bit lazy. I'm cleaning up a whole bunch of functions I wrote right now, and want to change stuff like this...

include_once("../config.inc");
echo ("
<h3>Please select a professor</h3>
<p>
<form target=\"mainpage\" action=\"editprof.php\" method=\"post\">
Edit Professor Data:");

To be a bit more cleanly, maybe more like this:

include_once("../config.inc");
echo ("
<h3>Please select a professor</h3>
<p>
<form target=\"mainpage\" action=\"editprof.php\" method=\"post\">
Edit Professor Data:");

(I hope the tabs and spaces show up right).

What's something good to do this with?

Rob
 

bUnMaNGo

Senior member
Feb 9, 2000
964
0
0
hmm the tabs don't show up correctly here =\ sorry... I found that using textpad, selecting "replace", and pasting in what you wanna replace worked rather well
 

Entity

Lifer
Oct 11, 1999
10,090
0
0
Ok, the tabs & stuff don't show up right (not sure how to do this on a FT board...but I think you get the idea. Have tabs, etc., inserted where they should be...i.e. after if clauses, etc.

Rob
 

gopunk

Lifer
Jul 7, 2001
29,239
2
0
hmm, working on a php page here right now... be interested in hearing if anybody has anything. btw, how do you frickin' debug stuff... do i have to download that dbg thing, or is it as simple as setting some global variable....
 

Entity

Lifer
Oct 11, 1999
10,090
0
0
Originally posted by: gopunk
hmm, working on a php page here right now... be interested in hearing if anybody has anything. btw, how do you frickin' debug stuff... do i have to download that dbg thing, or is it as simple as setting some global variable....
Are you working on it in Windows? I usually just insert code that reports the errors...like this:
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
Guess that probably doesn't help.

Have you tried PHPEdit?

Rob
 

gopunk

Lifer
Jul 7, 2001
29,239
2
0
Originally posted by: Entity
Originally posted by: gopunk
hmm, working on a php page here right now... be interested in hearing if anybody has anything. btw, how do you frickin' debug stuff... do i have to download that dbg thing, or is it as simple as setting some global variable....
Are you working on it in Windows? I usually just insert code that reports the errors...like this:
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
Guess that probably doesn't help.

Have you tried PHPEdit?

Rob

hehe, yea you give me too much credit. i'm talking about those really annoying and stupidly simple errors like the one i just *finally* found... ones where i make two variables with the same name :eek:
 

jjones

Lifer
Oct 9, 2001
15,424
2
0
Originally posted by: gopunk
Originally posted by: Entity
Originally posted by: gopunk
hmm, working on a php page here right now... be interested in hearing if anybody has anything. btw, how do you frickin' debug stuff... do i have to download that dbg thing, or is it as simple as setting some global variable....
Are you working on it in Windows? I usually just insert code that reports the errors...like this:
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
Guess that probably doesn't help.

Have you tried PHPEdit?

Rob

hehe, yea you give me too much credit. i'm talking about those really annoying and stupidly simple errors like the one i just *finally* found... ones where i make two variables with the same name :eek:
You should try out PHPed from NuSphere. I've been using it for the past week and like it quite a bit. Download and install their Technology Platform and you can run everything right on your desktop without having to be online. Run scripts, debug, create and access a database, etc. Very convenient. It has a built in debugger that I'm just checking out now to see how that works out.

 

manly

Lifer
Jan 25, 2000
13,193
3,977
136
Emacs with a good PHP major mode would probably reindent source just fine (not speaking from direct experience).