My web server - PHP and JavaThe relationship between PHP and Java

PHP and JavaThe relationship between PHP and Java has changed significantlywith each new release. Unsurprisingly, given the source code, PHPinitially had much more in common with C. PHP4 supported integra- tion of PHP and Java using a Java Servlet environment or, more exper- imentally, directly into PHP. Finally, with the overhaul of the objectmodel in PHP5, there s a distinctly Java feel to the PHP approach toobject oriented programming. Java users will find much of PHP5 snew object model very familiar, though with important differences. Given these changes, as PHP takes on a more Java-like cast, there aretwo possibilities for which a discussion of PHP and Java might bepertinent. You might need to work on a project that requires PHP andJava or Java Server Pages (JSP) to work in tandem. Or you may beapproaching PHP from a Java background and want to know aboutthe similarities and differences in order to learn PHP faster. We willdeal with both needs in this chapter. If you don t have a need to use Java, or aren t already familiar withthe language, this chapter won t do much for you. PHP for Java programmersMost projects won t require integration of Java and PHP, unless thereis some specific need due to pre-existing architecture. The Java pro- grammer approaching PHP for the first time may still want to knowmore about how PHP compares to Java for the purposes of learningPHP scripting. SimilaritiesIn this section, we discuss some ways in which PHP and Java are similar. SyntaxThough PHP syntax is much closer to C, many conventions used inJava apply to PHP as well. Code is whitespace insensitive, statementsare terminated with semicolons, function calls have a similar struc- ture (my_function(expression1,expression2)), and curly braces({and }) make statements into blocks. PHP supports C and C++-stylecomments (/* */as well as //), which are also used in Java. 3939CHAPTER …In This ChapterPHP for JavaprogrammersJava Server Pages (JSP) and PHPIntegrating Java and PHPThe Java extensionThe Java object in PHPError handling andreporting …
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.

Leave a Reply