Skip to content

Well-Known Differences#


In order to detect whether the code runs under the standard php or under .NET (PeachPie), PeachPie introduces global constant PEACHPIE_VERSION.

if ( defined('PEACHPIE_VERSION') ) {
    // code runs under .NET

The constant has a string value with the full PeachPie version including the prerelease suffix. When the code above is compiled by PeachPie, the entire condition is eliminated thus allowing for the code to be further optimized.

Garbage Collection#

It is important to remember, the .NET runtime has its own Garbage Collection mechanism. It destructs objects in a different order than standard PHP does. Behavior of destructors is not defined yet. Any destructors defined in the compiled code produces a compile-time warning.

DEBUG constant#

When the application is compiled in the Debug configuration, the DEBUG constant is defined implicitly. Debug is the default configuration. This results in an exception in user's code whenever the code tries to re-define the DEBUG constant.

// results in an exception, since DEBUG is already defined.
define('DEBUG', 1);