Pas2Php will translate a large subset of Object Pascal to PHP, allowing you to write web applications using Lazarus/FreePascal, and then run the application on a standard HTML/PHP server.
Over the last week, a lot of work has gone into Pas2Php. Most of the major issues are resolved. There are still a number of incompatibilities which are either not fixable, or have simple workarounds. As of v0.5, you should be able to write entire PHP applications in Pascal. The key to coding for Pas2Php is to understand the limitations of PHP. Read the example code provided, and always check the outputted PHP code to understand how this works.
As a guide to what Pas2Php can achieve... this web site is written in Pascal, and then converted to PHP. (The code is in the source package). Pas2Php uses the Pascal Parse Tree Classes (PasTree) which comes with FreePascal, and therefore the parsing limits are defined by this library.
You can download the latest source of Pas2Php from this site which includes an example project. There isn't much documentation, so, if you want to use Pas2Php, you will have to experiment with the code.
Language Feature Status Table
Note: Features that are "Done", may still need testing. This is just a guide to the progress of the conversion.
| Procedures (with Parameters)||Done|
| Functions (with Parameters)||Done|
| Support for properties||Done|
| Case Of/Else||Done|
| For/Do (with Downto)||Done|
| Local/Global Variables & Constants||Done|
| String Indexing From 1 (Pascal Style)||Done|
| Variant Array Support||Done|
| Nested Functions & Procedures||Done|
| Classes with Variables||Done|
| Classes with Methods||Done|
| Support for Objects||Done|
| Basic PHP Functions||Done|
| Basic Pascal Functions||Done|
| Record Support||Done|
| Var Parameters Support||Done|
| Use PHP Constants (ie: Not Global Variables)||Done|
| Support for Packages (Multiple Modules)||Done|
| Automatic Unit Loading||Done|
| Basic Enum Support (ie: Index Only)||Done|
| Inherited Method Calls||Done|
| Try/Finally/Except Support||Done|
| Default Argument Values||Done|
| Function Aliases (Map Compatible Pascal to PHP)||Done|
| Built in Identifier Name Checking||Pending|
| With/Do Support (Maybe...not)||Pending|
| Redundant Code Removal||Pending|