Appendix B. PHP for Perl Hackers
In this appendix, we assume that you know Perl, but not PHP, and are looking to quickly get up to speed in PHP. The good news is that the two languages are very similar indeed.
This is by no means a comprehensive guide to how Perl and PHP compare. Although similar, and sharing some ancestry, they really are distinct languages with distinct syntaxes and feature sets, and there is no replacement for getting to know them individually. Our main goal for this appendix is to save you some time up front — to warn you, for example, that
elsif means nothing in PHP (but that
elseif, however, is significant) rather than letting you debug your way to that realization.
In this section, we discuss some ways in which PHP and Perl are similar.
Compiled scripting languages
First, the obvious: Both Perl and PHP are scripting languages. This means that (unlike compiled languages such as C) they are not used to produce native standalone executables in advance of execution, which can then be run without reference to the language they were written in. Instead, Perl or PHP source files are both fed to an appropriate engine at execution time. This does not mean, however, that Perl/PHP code is interpreted line by line at execution time; in both Perl and PHP, scripts are quickly and automatically compiled at execution time and then executed. But it does mean that the development cycle for PHP/Perl programmers is edit-execute, rather than edit-compile-execute, as in ...
Get PHP6 and MySQL® 6 Bible now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.