Communication is key to building applications now and for the future. While it is not something that I think that everyone should do, I have not seem many applications that make good use of streams in PHP. Streams can be immensely useful in the right situations, but a lot of developers are not really aware of how streams can be used. In this excerpt from chapter 4 of my book “You want to do WHAT with PHP?” I talk about how you can use streams for fun, and maybe for profit. While I don’t think you will end up basing your application around streams it is a really good idea to know how streams work. With that in mind, here is an excerpt from the book.
The chapter on Character Encoding was probably my favorite chapter to write. I hadn’t even submitted it as a chapter in my initial book proposal. Then I was at a customer site who was having some issues with UTF-8 and they asked me if I knew UTF-8. I said yes, and I was right. However, as I examined their problem I found that I knew less than I thought I did. Then I realized that while this 3.5-year PHP consultant knew Unicode, UTF-8, character encodings such as ISO-8859-1 or ISO-8859-7, I didn’t understand them as well as I thought I had. With that I threw this chapter in the book. Knowing about character encoding is what many developers have. Not as many truly understand it. In this chapter I try to de-mystify character encoding as a whole. In other words, it’s not something that messes up how your web pages look, but rather, it is a tool for you to use to make your site available. With this chapter you will learn the history of character encodings and why they’re so messed up. Additionally, you will learn how UTF-8 actually works and how it’s related to Unicode (it’s not the same thing).
PHP developers know text really, really well. We can write SQL, we can build HTML, we can work with XML. But computers don’t speak in terms of structured text markup, they speak in terms of bytes. And while there are many PHP developers who can speak at the lower level of bytes and bits and stuch, there are many more that have difficulty there. This chapter is here to help the developers who are not as familiar with communicating directly over the wire. This is a short excerpt from a very long chapter on Binary Protocols.
I am stupid busy right now. Between normal work, adoption (moreso the stupid state requirements), preparing for 3 user group meetings and 6 hours of speaking at OSI Days in India, working on the back yard, writing Flash/Flex articles and recording an album I really don’t have much time to get a whole lot done. I’ve got some really cool stuff as part of my normal work for the cloud that’s coming out, but getting that done has proven to be a challenge.
So, last year I wrote a book. This year it’s being released and is, in fact, almost out! Very exciting! It’s called “You want to do WHAT with PHP?” You will not find another book on the market like it. Mostly because other PHP authors are not as crazy as I am. Have you ever wondered if you could access a raw Linux ext2 file system in PHP? You will have the answer. Do you want to know how to scale your website that depends on long running requests? You’ll get that answer. Have you wondered why UTF-8 is so freaking annoying? You will understand it. If you wanted to read the funniest acknowledgments ever written for a technical book? You get it with this book.