+ 1
Which is better to use Javascript or PHP?
Can somebody explain me which of these two is better and why?
1 Answer
+ 2
In regards to programming, the languages are just tools and there is no overall better or worse, it's simply relative to the task at hand in a given moment.
However, JS and PHP isn't the type of comparison you want to make anyways. JS is a client-side programming language that allows you to create a lot of the interactivity that you see on websites. PHP is a server-side programming language that allows you to interact from the server end. When you combine the two, it allows for communication to take place between the Client and the Server, which allows for us to do a lot of cool things such as access databases to store or retrieve information.
So which do you pick between the two? Both of them. You have various options when it comes to the server-side language though, so poke around and decide which works best for your project. Personally, the main two server-side languages that I use are NodeJS and PHP, but go with whatever you feel comfortable with.
Also, once you've learned JS, I'd recommend that you also learn jQuery. It's amazing compared to the vanilla JS and it makes a lot of stuff much easier to deal with, such as AJAX requests or dealing with elements using familiar CSS selectors.