NOTE: To use the advanced features of this site you need javascript turned on.

Home Products nTile PtoJ Features Core

Core Features

Core features ensure that all possible variations of source code input are correctly translated.

Support for all PHP language constructs

All PHP language constructs (statements, expressions, operators etc.) are translated into their Java™ equivalents. Even complex constructs, such as LIST statements or nested arrays, are properly handled.

PHP files are organized into include hierarchies, allowing the invocation of functions within the hierarchy. nTile PtoJ preserves include hierarchies and properly resolves the function calls.

To see specific examples, please consult the Samples section.


Type inference

PHP is a dynamically and weakly typed language, meaning that variables do not have a fixed type and can participate in all kinds of expressions, conversions being performed on-the-fly. On the other hand Java™ is a statically and strongly typed language, with each variable having a type that is fixed by a declaration, cannot change during the execution and limits the kinds of expressions and operations in which the variable can participate without explicit conversion.

Read more: Type inference


Transformation of dynamic constructs

nTile PtoJ has specific algorithms for each category of dynamic constructs, transforming them into static evaluation expressions. Please consult the Dynamic Constructs samples for relevant examples.

Read more: Transformation of dynamic constructs


Handling of static class members

PHP static class members live across a single HTTP request. This means that they are not similar at all to the static concept in Java™. Instead, nTile PtoJ produces a translation that works on a shared class instance. For details, see the Static Members sample.

Handling of constants

PHP constants cause nTile PtoJ to generate specific structures in the dedicated GlobalConsts class. These structures include getter and setter methods that preserve the PHP "set-only-once" semantics. See the Constants sample.

Handling of references

PHP supports explicit references and has a set of rules for reference propagation and operations. nTile PtoJ preserves the specific semantics of this concept. The Java™ translation uses a dedicated Ref class, parameterized with the base type of the reference. The References samples contain relevant examples of reference handling.

Emulation of the PHP runtime

The PHP standard runtime is extremely rich – it contains almost 3000 functions in the global namespace. nTile PtoJ emulates the most frequently used ones, and is easily extensible if a particular translation project requires it. The global namespace is partitioned into specialized Java™ classes, for better encapsulation and maintenance. The Web and DB Access samples contain a few examples of runtime usage.