Hudzilla.org - the homepage of Paul Hudson PHP and PHP
Contents > Preface Wish List | Report Bug | About Me ]

1.6     A note for programmers coming from C, C++, or Java

NOTE: This is NOT the latest copy of this book; click here for the latest version.

The syntax and thinking behind PHP is directly based upon C and C++, and it shares many similarities with these languages - particularly when it comes to file handling and operating system functions. Having said that, PHP dispenses with much of the complexity seen in these languages - like Java, PHP only uses references, with no concept of pointers. Similarly, PHP will also perform automatic garbage collection for you, as with Java, although the PHP garbage collection is somewhat less aggressive.

To give you an idea of what you are getting yourself into, please read this short checklist:

  • PHP has object orientation, including access modifiers, inheritance, abstract and final classes, and more.

  • PHP does not have multiple inheritance. Instead, it follows Java's plan of allowing classes to implement an arbitrary number of interfaces.

  • PHP has flexible error handling using try/catch

  • PHP does not have operator overloading or function overloading

  • PHP has a flexible extension system based on C, so if you are familiar with C you can go ahead and make your own extensions.

Where there are similarities to C, C++, or Java in this book where you can put your existing knowledge to good use, this has been specifically highlighted.

Author's Note: Some of these statements aren't true for PHP 4: it has neither powerful object-orientation nor try/catch error handling. For the most part this book covers PHP 5, as it is the recommended platform for new PHP development.



<< 1.5 A note for programmers coming from Perl   1.7 Cross-platform PHP >>
Table of Contents
Top-right shadow
 
Bottom-left shadow Bottom shadow