O'Reilly logo

Data Push Apps with HTML5 SSE by Darren Cook

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix C. PHP

PHP has been chosen as the principal language for the examples in this book, for various reasons. When combined with Apache, it allows the example code to be quite short, with very little scaffolding code needed. The syntax is straightforward and readable by anyone familiar with any mainstream programming language. And it fits the existing infrastructure advantage (see Comparison with WebSockets) of SSE very nicely, because a lot of people’s existing infrastructure is already built on top of PHP.

As I said, I have tried hard to make the PHP code readable by any programmer. This appendix explains those few features where something a bit more PHP-specific was used. Explanations link directly to the related section in this appendix, at the time the feature is used.

This appendix is not intended as a general introduction to PHP. There are countless books and websites that can do that for you. The PHP online documentation is an excellent starting point. If you are looking for a book in the context of dynamic websites, Robin Nixon’s Learning PHP, MySQL, JavaScript, and CSS (O’Reilly) looks comprehensive. Programming PHP, by Kevin Tatroe, Peter MacIntyre, and Rasmus Lerdorf (O’Reilly), focuses on just the PHP language, again in the context of dynamic web pages.

Classes in PHP

Classes in PHP (as of PHP5) are closer to the classes in C++, C#, and Java than the classes you find in JavaScript, but if you have used any object-oriented language before the code used in this book should ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required