A well and clear written primer on PHP.
By David Sklar
O’Reilly Media, Inc., 2016
The book consists of 20 chapters that gradually introduces the basics of programming in PHP. There are lots of concrete code examples, progressing in complexity throughout the book. Each chapter ends with a set of exercises. Solutions to the exercises are included in an appendix.
Chapter 1 shows us some code samples to illustrate typical program elements like outputting to a web page, reading from a database and such. We are told that it is good to put lots of comments in our source code – I think it would be better to advice the use of comments only in case the program text can’t explain itself. Apart from this, the content is well written and the explanations are clear enough.
Chapters 2-11 have the basic information about the language constructs, including variables, control structures, arrays, functions, files, objects, working with web forms, databases, cookies, sessions, and REST API’s.
Chapters 12-20 talks about debugging, testing, source control, date and time handling, package management, email, frameworks, command-line PHP and internationalization.
Who is this book for? According to the author:
Aside from basic computer literacy (knowing how to type, moving files around, surfing the Web), the only assumption that this book makes about you is that you’re acquainted with HTML. You don’t need to be an HTML wizard, but you should be comfortable with the HTML tags that populate a basic web page, such as <html>
, <head>
, <body>
, <p>
, <a>
, and <br>
.
So, a typical reader might be someone who is using a CMS like WordPress or Joomla, but would like to understand the details of how the CMS is working.
Another typical reader might be a programmer who knows other programming languages, and would like to get started with PHP.
I think the author manages to write for the intended target groups quite well. There is enough information in here to get the reader started with using PHP for basic web programming.
Highly recommended.