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

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

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
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.



My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!



Top-right shadow
 
Bottom-left shadow Bottom shadow

Comments from other readers
Pedro - 06 Sep 2008

I am glad I am not coming from C, C++, or Java and I have not clue about the short list.
Hope the short list will become clear down the road.

San Diego CA US 26 Jan 2006

A PHP User - 06 Sep 2008

Do you distinguish between PHP4 & PHP5 behavior where it's notably different? (Many of us out here only have access to 4 at this point.)



Add comment
Please note that by posting a comment here you are committing it to the public domain. This is important so that others can make use of your code themselves, and also so that I can incorporate helpful notes directly into the main text. Comments are limited to 2000 characters in length.

If you are reporting an error in the content, please tell me directly.

Your name/email address:
Your comment:
 
Now, in order to verify that you're a real person, please answer this simple question: what is two plus one?
The answer is:
(please write in
numbers, eg 19)


Top-right shadow
 
Bottom-left shadow Bottom shadow