What is PHP, anyway?

PHP is nearing it’s sixth version and – believe it or not – nobody really knows what PHP language is. Well, I’m a bit overstating, but a lot of people have all kinds of ideas how PHP should do all kinds of things, but where one looks for the final answer? Where do I look up for how should specific thing in PHP work? OK, there’s of course The Manual – and don’t get me wrong, it is very good. But it’s not the final source on every detail of every trick of the language – it is more description than definition. It does not set the formal rules for every case and every aspect, though it provides pretty good explanation on how the language works. In fact, the only definition of PHP language we have now is the source of the Zend Engine. Which is, with all due respect, not a very accessible source. My opinion is that is long overdue to have something like that. Meaning, a formal definition of PHP language. With formal grammar and stuff.

So, who’s going to write that? Don’t you look at me, I’m not a technical writer and English isn’t even my native language. 🙂 Seriously, if anybody wants the thing done it should be PHP Group effort which is officially (as officially as anything can get in the fluid opensource world anyway) supported and endorsed. And of course, the standard word should be final – meaning, once it is there and manual or engine disagree – that’s manual’s or engine’s fault. Be sure – it is a lot of work. It’s not just rewriting the manual in more formal style – there are bits of the language that 99.9% of developers really didn’t ever think about – like what happens with reference-assignments inside arrays when array is copied? How __get is supposed to work in case when you access unexisting property and then want to modify it? and so on. Describing all these formally is a challenge by itself. But my opinion is – it can be done and it should be done.

P.S. PHP is still under development – and may forever be, and it’s a good thing. So the formal spec would not be frozen – it probably would be amended numerous times. But even the process of amending would make potential proposers to refine their thoughts and think about various aspects they may have forgotten. Which is additional bonus to having it.