Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>PHP and Java are very different beasts. Translating Java to PHP is likely to be so technically difficult that it next to impossible to implement for a subset of Java / Java EE functionality that was large enough to be worthwhile.</p> <p>You'd do better either:</p> <ul> <li>learning and using PHP, </li> <li>implementing your entire server in Java, or </li> <li>using a bridge that allows you to call into an embedded JVM from PHP; for example, <a href="http://palava2.org/why.html" rel="nofollow noreferrer">palava</a> (thanks @Willi).</li> </ul> <p><strong>EDIT</strong></p> <p>@nhbh comments thus:</p> <blockquote> <p>PHP is very similar to Java nowadays. It supports object orientation, can be executed from the command line without web request and can maintain a global state across requests using ACP. So writing a cross compiler from Java to PHP would be rather easy. But of course it is a huge amount of work to port API calls, so I doubt it is worth the trouble.</p> </blockquote> <p>There are obvious similarities between Java and (OO) PHP. But there are fundamental differences as well that make translation problematic:</p> <ul> <li><p>There are fundamental difference between Java primitive / builtin types and their PHP equivalents. Java integer and floating point types don't map directly because of range considerations. Java Strings don't map because PHP strings use 8 bit characters. These will cause problems getting simple Java code to work correctly when translated to PHP.</p></li> <li><p>Java's threading, synchronization and the underlying memory model are probably untranslatable.</p></li> <li><p>Java dynamic classloading, reflection, security and object serialization APIs are probably untranslatable. (In the last case, I would claim that a mapping is only complete if it produces byte-for-byte compatible serializations.)</p></li> <li><p>Creating bridging APIs for the breadth of the Java APIs would be a <strong>huge</strong> task.</p></li> <li><p>Interfacing with native PHP is likely to cause problems; e.g. Java calling PHP and vice versa, and Java code dealing with objects/values created by PHP code.</p></li> </ul> <p>In summary, a full-function Java to PHP translator is probably next to impossible. The best you could hope to achieve would be a partial translator that only worked for a small subset of real-world Java code.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload