Hacker News new | past | comments | ask | show | jobs | submit login

The PHP grammar in BNF starts at line 10354. It not that extensive as some may think and rather similar to what Java BNF looks like. The expression statement is a bit more extensive than in most languages, as PHP also supports the little known template-style (if elseif endif;): http://php.net/manual/en/control-structures.alternative-synt...

Thanks for the PHP spec.

Btw. GitHub says "Sorry, this blob took too long to generate.": https://github.com/php/php-spec/blob/master/spec/php-spec-dr...




I got the same message on GitHub. Did you checkout the repo in order to read it?

Personally, this is exciting news, but I'm not sure that PHP is ready for this after 20 years. There's plenty of cleanup that needs to be done to userland naming conventions and parameter orders that in all likelihood won't get done anytime soon to avoid breaking BC


yes, you can also use the "Download Zip" button there: https://github.com/php/php-spec

PHP ships with a lot of third party C libraries that are exposed in PHP with usually their original function names. Object orientation came with PHP 4 and later with PHP 5 the new better one (5.3+ with namespace support, traits, etc.).

You can think of PHP as a mixture of C, C++ and Java for web development and CLI tools. I personally use all four languages, each one for specific purposes where the fit best. You can find function names like strstr in C, C++ and PHP (= indexOf in Java and JavaScript) - not a big deal.


I'm at work so I was looking to peruse the proposal without downloading things. You can read it from PHP's git mirror: http://git.php.net/?p=php-langspec.git;a=blob_plain;f=spec/p...

I'm not sure that I would call PHP4 objects object oriented, as I remember it, it was all such a huge hack (down to being able to return null from a constructor). I only had to maintain some code like that at the tail end of PHP4's life, so I never found out whether that was how OOP was done in PHP4, or if it was a hack to simulate OOP in a language that didn't support it.


Hack has actually dropped support for that format, the only place I've ever seen it used seriously is in wordpress.


The alt syntax is pretty heavily used in frameworks that use vanilla PHP for their view templating, including the Zend Framework..




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: