Well, like you alluded, JavaScript is executed on the client side, so it would depend on the client. For example, a client on an iPAD wouldn't be able to run those Quake3 HTML5s as smoothly as a client running on a gaming machine. PHP on the other hand runs on the server.
In general, JS is faster considerably than PHP though (on the same hardware);
Here are some [hard figures][1] of tests between the two, to back up my assertion. [JS (query) vs PHP][2] Performance.
[1]: https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/php.html [2]: jQuery vs. PHP - Performance Comparison
Answer from Authman Apatira on Stack OverflowWell, like you alluded, JavaScript is executed on the client side, so it would depend on the client. For example, a client on an iPAD wouldn't be able to run those Quake3 HTML5s as smoothly as a client running on a gaming machine. PHP on the other hand runs on the server.
In general, JS is faster considerably than PHP though (on the same hardware);
Here are some [hard figures][1] of tests between the two, to back up my assertion. [JS (query) vs PHP][2] Performance.
[1]: https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/php.html [2]: jQuery vs. PHP - Performance Comparison
Its worth saying that another consideration for using PHP is the ability to cache server side. I'm looking at this considering if I should move some of the functions from JS to PHP because if I then cache the files server side there is no further calculations involved at all! I know this ticket is old but this may be another consideration for future readers.
PHP is 4x faster than JavaScript!
Why is JavaScript Often Considered Superior to PHP?
PHP vs Node.js
Really refreshing to see all the comments here with practical suggestions, and avoiding all the 'x is better than y'.
I'll add that, working in both Europe and North America, PHP is massive in Europe but seems to be more on a steady decline in NA (at least the cities I've worked; Toronto and SF). In Toronto we used to have a big regular PHP meetup, but attendance has dropped over the last 10 years and has been fully cancelled maybe a year or two ago.
More on reddit.comCan i make PHP as fast as Node.js?
What's the difference between PHP and JavaScript?
What is JQuery?
Which aspect is the most important when choosing the best online learning platforms?
Videos
Hello everyone,
I've been pondering a question and thought this would be the perfect place to seek some insights. I've noticed that in many developer circles, JavaScript is often lauded as a superior programming language compared to PHP. However, from my understanding, PHP has a significant capacity in terms of backend development, and it powers a large portion of the web (think WordPress, for instance).
I'm curious to know why JavaScript is generally held in higher esteem. Is it because of its versatility in both frontend and backend development through Node.js? Or is it more about the trends in web development that favor JavaScript frameworks like React and Angular?
I'm genuinely interested in understanding the technical and practical reasons behind this perception. Of course, I believe both languages have their strengths and use cases, but I'd like to hear your thoughts on this.
Why do you think JavaScript is often seen as superior to PHP?
What are the key strengths of JavaScript that might overshadow PHP's capabilities?
In what scenarios would PHP be a better choice over JavaScript?
Looking forward to your opinions and insights!