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

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.

 

Next chapter: Cross-platform PHP >>

Previous chapter: A note for programmers coming from Perl

Jump to:

 

Home: Table of Contents

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar