4 ms·
Is it any worse than Javascript, if we're honest?
by ams6110 10y ago
Is it any worse than Javascript, if we're honest?
- bduerst 10y agoBoth have their issues, but js is probably a little more advanced with prototyping.
- pdpi 10y agoYes it is, and I really don't like JS much to begin with. There's seriously wonky things in there like the associativity on ?: being wrong, and == being even more broken than in js. There's order of arguments on array_map and array_filter being inconsistent. It's not that there's a massive flaw in there that kills it, it's death by a thousand paper cuts.
- mywittyname 10y agoPHP's massive flaw is that it does one thing very well (web-dev), but does everything else rather poorly. It becomes the default choice for projects that start out as a web front-end, but then gets used in other situations where it's ill-suited. A lot of PHP projects have components that are hacked together and work, but are confusing and less-than-ideal from a design perspective. Threading/asynchronicity comes to mind. I've worked on a few projects that started out as a web-front end, but then needed to do some background processing. Eventually the background process needs to be multi-threaded and the choices are: rewrite your code to support pthread's wrappers classes, use fork and shared memory segments, asynchronous web requests. All those solutions work, but they are much more complicated than the same task would be in most other languages with native threading support.
- LoSboccacc 10y agoJavascript ain't that bad, it's interacting with browser exposed api variants that sucks but there are many wrappers to solve that issue. The real annoying part is that by nature it will never have the same amount of IDE niceties you'd get with more typed languages
- piva00 10y agoNo, JavaScript has a lot of quirks like the '==' vs '===', empty arrays equalling to false or this kind of stuff: http://stackoverflow.com/a/1995298/398142 http://stackoverflow.com/a/1995298/398142 I understand JS having its place as being ubiquitously supported in browsers but, just as PHP, it's bad and its problems are not about niceties from IDEs or static typing.
- wtbob 10y ago'Not worse than JavaScript' is a low bar to clear. JavaScript has exactly two advantages: it is deployed everywhere, and it is dynamic. The latter means that with sufficient pain one can accomplish whatever one needs to. It's not quite bad enough to count as a Turing tarpit like INTERCAL or brainf*ck, but it's one of the closest mainstream languages to the tarpit.
- kahnpro 10y agoI like to call JavaScript "the PHP of the 2010's"
- nuncanada 10y agoI prefer PHP to Javascript... And PHP does sucks.
- qihqi 10y agoPHP is like Javascript in that both languages are now being used to do what they were not designed for.
- spitcode 10y agoIn my opinion JavaScript is being used exactly what it was intended for now more than ever. It was originally supposed to be based on Scheme (an elegant functional language) and after many years the trend of functional reactive programming has finally become mainstream. I find it quite sad that most PHP developers seem to think that writing code that looks more like Java is the "correct" thing when its greatest features have always allowed loose types and first class functions. After all that's what makes it so easy to work with? Perhaps PHP could have been more like Scala a few years back already.. the perfect combination of Objects and Functions...
- segmondy 10y agoNo, they are both the same, where else can you evaluate '5' + 2?