PHP or Javascript? | SoloLearn: Learn to code for FREE!


PHP or Javascript?

Recently, I have begun learning the web development languages. I understand that HTML and CSS are necessary. But should I use PHP or JS for back-end programming? I dont really understand the difference between them. I've also heard that Python can be used in place of PHP and JS. Is this true? And if so, how? One more thing: Where does Angular.JS and Node.JS come into play? What do they do? I'm sorry if this is a lot, but as a hopeful web developer I would appreciate all the help you can offer. Thank you!

2/4/2019 12:41:39 AM


58 Answers

New Answer


Thats a lot of questions so I'll try to keep it short. On the backend you can use almost any language, the most common are js, php, python, C#, Java. Django and Flask are popular frameworks for creating webapps in python. I prefer using js on the backend because then I can use the same language both front and back which is nice. You can use any language you like though, none is inherently better than the others. nodejs is the way to do javascript on the backend. You can't do backend js without nodejs, as javascript is usually a frontend language. Angular is a frontend framework for creating rich websites and it does a lot, you best check out their website for more details on that.


Is not fair to compare PHP vs JavaScript, as they both have different purposes for web-site development. PHP is a server-side scripting language while JavaScript is a client-side scripting language. In fact, the most dynamic website is created when we use functions of both these languages together. If PHP is like a paint-brush to paint picture, then JavaScript is a paint-color. PHP stands for "Hypertext Preprocessor", is a programming language embedded in HTML that does all sort of things like build custom web content, send and receive cookies, evaluate form data sent from a browser, etc. It is integrated with number of popular databases like Postgre SQL, Oracle, Sybase, SQL, and MySQL. PHP also supports major protocols like IMAP, POP3 and LDAP. PHP can handle forms, save data to a file, return data to the user, gather data from files, etc. Example: Let say a website that takes user to view the order status after logging in. By PHP coding, you would send a query to the database that would then output the specific user information based on what information is in the database While, JavaScript is designed for creating network-centric applications. With JavaScript, web pages will no longer be static HTML and allows the program that interacts with the user, control the browser, and dynamically create the HTML content. The advantage of JavaScript is that it has less server interaction, allowing you to validate user input before sending the page off which means less load on your server and less server traffic. JavaScript allows immediate feedback to the visitors.


Paul Onteri Oigara When comparing PHP with Javascript in the browser, your points are valid. However, Javascript in NodeJS not only competes directly with PHP for server handling of HTTP requests, NodeJS goes much further than just web applications. NodeJS can run as background processes, scheduled tasks, CLI, desktop, and mobile apps, and completely outside the context of any external web server. From a usage standpoint, PHP is a bit narrow in scope compared to NodeJS.


Moctezuma II I typically recommend new web developers to focus on NodeJS before moving on to other backend platforms. This will allow you to really work on mastering Javascript which will help on both the frontend and backend. I also highly recommend ReactJS based on the demand for this over Angular 2+. There is a bit of a learning curve, especially with React-Redux. However, there are powerful benefits you can look up. You'll also want to throw in MongoDB for your database. Your next language will be based on the type of work you will take on. That said, there is quite a demand for new development work in the MERN stack. MERN: MongoDB + Express + ReactJS + NodeJS. The MEAN stack replaces ReactJS with Angular.


Learn any language deeply, masters in that's be confident ..every language Important,,,


Well, in summary, both PHP and JS are necessary. Both languages have different purposes.


Marvis Omolu They are both important to know. However, I've really favored working with NoSQL databases the past few years. It depends on different requirements for transactional support and schema consistency. If these mean little to you, then MongoDB is a great database. 😉


I would like javascript cause it can be used create animation and handle all things in our own way, that php doesn't include and also for each and every bit to be changed it needs to refresh full page.


You'll need some JS anyway, same as HTML and CSS, it's necessary on the frontend in most cases. Angular is one of the frontend JS frameworks that helps you in that (others are React or Vue, for example). Then for backend, you can either stick with JS (with the help of Node framework) or choose a different backend language (Python, PHP......) which will have their own frameworks. You will choose the backend language based on your preferences or the need of the website, and depending on which languages you wanna learn. For example, people who know JS well will maybe want to stick with JS for backend, not to have to go through the effort of learning a whole new language. But you need to still learn Node. On the other hand, Python may be more friendly and versatile, so if you already know it, or wanna learn it for other purposes anyway, it may be a better choice. PHP is used on most existing websites because backend frameworks for Python and JS didn't exist or because WordPress is based in it. 🎈


r f Yes. However, I was commenting within the context of the question regarding PHP and Javascript.


// JavaScript because it's a good programming language to coding easily.


Node.js and php both are use for backend And if you want to use node.js you should learn javascript first But if you want to learn php then go for it Node.js is new and many programmers are using it but php is also a good option


For future threads, I recommend one question per thread. It will make it easier for you to check for prior answers and easier for community members to provide focused answers.


David Carroll [ "... That said, there is quite a demand for new development work in the MERN stack..."] Is there a demand for new developments in ASP.NET Core?


Php is going to be taking a back seat as Javascript replaces it. Javascript can do everything php can + more. and more efficiently.


javascript if youre looking for a job


Moctezuma II that's one way to think about it. I prefer to recommend that people pick the goal before picking the tools (languages, frameworks, etc.).


As i know; JavaScript is Client Side where PHP is Server Side language. But Professional programmers can use each one instead of another! As a Newbie, I don't recommend you to do so for now!


Igwe node.js... why does everyone ignore node.js? Node.js is an awesome way to write your back-end with js, also , node.js isnt limited to that, it can do much more than just servers, from running on the raspberry pi, to desktop apps (eg: discord, skype and slack are made with electron wich is a node.js module).....


I prefer JavaScript