3 ms·
PHP is a programming language (that is, a formal grammar for specifying the operations a computer should perform), but also an implementation of an interpreter
by derefr 16y ago
PHP is a programming language (that is, a formal grammar for specifying the operations a computer should perform), but also an implementation of an interpreter for that grammar. You're talking about the implementation, which is of fair quality (certainly better than, say, MRI Ruby) and very widely-deployed, a combination which many devs (brilliant or not) take advantage of.
People who say PHP is badly designed, however, aren't talking about the implementation; rather, they're strictly talking about the language itself—the syntax, the semantics, and the standard library. There is no advantage to the way PHP-the-language does things; it makes nonsensical choices (like the flat, disorganized, all-libraries-included function namespace, the inability to chain method calls in a single expression, the extreme amount of "weakly-typed" cruft surrounding the comparison operators, etc.) which derive no benefit.
It would be strictly beneficial to the programming ecosystem if PHP-the-language were treated as an object-code for other, better-designed languages to target, such that PHP-the-implementation could be used without needing to write in PHP.
- blasdel 16y agoPHP-the-implementation is pretty spectacularly shitty too — it'd be even worse than MRI for persistent processes of any sort. What's good about PHP is the execution/dispatch/deployment model, which papers over massive deficiencies in the infantile implementation (much less the know-nothing language).
- pornel 16y agoPHP is not supposed to have persistent process of any sort. It's stateless (if you shard/share sessions well, it's super easy to scale).
- nir 16y agoExcellent point, and often (as now) overlooked. PHP does have some brilliant design choices, for example attaching itself to the Apache process, terminating when the request ends - this makes a lot less vulnerable to issues like memory handling. Some extensions may leak like a sieve, but since it's all cleaned up when the request ends it never really becomes a problem.
- xentronium 16y ago> certainly better than, say, MRI Ruby Care to give some proof? Say, performance-wise, MRI is not any worse than PHP[1]. And as far as I understand, PHP implementation is just plain horrible[2]. [1] http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&lang=yarv&lang2=php http://shootout.alioth.debian.org/u32q/benchmark.php?test=al... [2] http://blog.paulbiggar.com/archive/introducing-malicious-code-reviews/ http://blog.paulbiggar.com/archive/introducing-malicious-cod...
- pbiggar 16y agoI spent a few years immersed in both PHP the language and PHP the implementation. Each is as shitty as the other.
- wbond 16y agoPHP has been able to chain method calls and members since 5.0. The main thing that can't be chained outside of PHP trunk is array access after a method or function call.