Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

PHP tidy code

Posted on 2007-11-15
15
1,073 Views
Last Modified: 2012-08-13
I am wondering if anyone knows of a PHP code tidier, I have seen: http://prettyprinter.de/ But try to tidy some PHP and it changes <b> to the &3t, like that and messes with my HTML.

Any suggestions on a PHP cody tidier?
0
Comment
  • 8
  • 7
15 Comments
 
LVL 21

Expert Comment

by:nizsmo
ID: 20291460
You can try  SourceFormatX:
http://www.textrush.com/formatx.htm

Hope this helps.
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20291465
Also for your HTML you can try this see how good it works:
http://www.phpbuilder.com/manual/en/ref.tidy.php
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 20291493
I am also on a Mac any suggestions there?
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 21

Accepted Solution

by:
nizsmo earned 500 total points
ID: 20291663
sorry not that i know of. Although time consuming, it may be best to tidy the code manually using a good editor, as i find that you know exactly what has been done to the code, instead of taking a chance where the code may be change in some way by the code tidier program.

Hope this helps in some way.
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 20291683
Thats a good point, get you use to your own code, etc.
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20291700
yep, and you know that you woudn't run into any trouble.
A good practice though is to try and keep your code tidy when writing it, so that you don't have to do this at the end!

Indentation and commenting your code is an essential practice to good programming for any language.
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 20292063
I know :) I need to keep that in mind, haha.
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20292087
All good :)

sorry i couldn't suggest a straight solution to your problem, but hopefully what i said has helped in some way.
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 20295017
Thats fine! Thanks anyway. Have you tried that link you sent me? Just curious to see how well code tidiers work, trial run.

Ryan
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20295062
Which one are you talking about? SourceFormatX?
I had that installed for a while, it does do a reasonable job at tidying it up, however I don't like the feeling of letting another program take control of my code, so eventually i abandoned it. :)
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 20295084
Haha...yeah, I was talking about the PHP add on the php site. Are you talking about SourceFormatX?
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20295126
Yes sorry was talking about the wrong thing:p

as for the other one, i used it a while back, it was OK.

There is this new one (HTML TIdy) for PHP5, looks very cool and easy to use if you are thinking about tidying up your code using php:
http://devzone.zend.com/node/view/id/761

0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 20295164
Oh nice, let me take a look at this, does that just do PHP? Or HTML/PHP as well.

I couldnt really tell from the site.
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20295177
i think it does html side of things only (css, html, etc...not sure about javascript), as it is CALLED from PHP, so it can't tidy itseif :P
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 20295260
Hahahaha valid point!

RYan
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question