How old code indenting

Hello, I have very many PHP files that are indented badly and making the code less professional and difficult to read.

So I’m looking for a script (bash, perl, etc…) That converts the code (class, function, etc…) With a standard indentation and beautiful.

Thank you.

Would you be manually selecting the code and hoping that a simple program that make it beautiful? If so, it looks like this script is a good option.

Is all the old code indented differently or consistently? If consistently you can use search and replace and choose to remove x number of spaces? You might be able to use this approach in several passes?

Otherwise in Eclipse the Opensource IDE for Java, PHP and other scriptable languages there is a plugin like HTML Tidy that works with PHP. You might want to give that a try if all else fails.