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.
Want to learn PHP 7?
Hacking with PHP has been fully updated for PHP 7, and is now available as a downloadable PDF. Get over 1200 pages of hands-on PHP learning today!
If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!
Next chapter: Cross-platform PHP >>
Previous chapter: A note for programmers coming from Perl
Home: Table of Contents
Copyright ©2015 Paul Hudson. Follow me: @twostraws.