7

PHP vs Node.js

Please give your valuable opinions as I am want to learn backend as soon as possible.

Which one is best for backend purpose?

Comments
  • 18
    Both, neither, depends on the circumstances and project.

    Node is the trendy one, php is the tried and tested one that doesn't break every time you deploy it due to a random 15th party dependency.
  • 8
    IDK, it depends what you need and what you feel more comfortable with. With NodeJS you can run your backend and it dosen't die after each request so if you need "state" you can have it, PHP can use only files and database for having "state".

    Other than that I believe (but someone may prove me wrong) PHP 7+ is faster than node.js. Also it's up to your preferences, there is no such thing as better or worse per se. They are just different.

    If you ask for my personal opinion? PHP.

    E:
    forgotten to mention that PHP is much more mature software which is a good thing.
  • 1
  • 3
    @DubbaThony you could use sessions or memcache fo manage state between requests, but you're right, a database is typically used depending on what's going on.
  • 2
    @C0D4

    Session is file.

    Memcache is external program. You could even write yourself simple low-level app that can store your input and allow easy retrival. But it still will not be part of php itself.
  • 3
    @DubbaThony well yea I'm not disagreeing here, but given the options with php being stateless by its self, The only options are using a file of some kind or external cacheing system unless you write to a database.

    @M1sf3t 😵you stole ma popcorn?
  • 1
    @C0D4

    Exacly, that's what I ment by my post :)
  • 3
    @M1sf3t don't tell @Jilano but mmmm popcorn
  • 1
    @DubbaThony You can change the session handler and use a database, a Memcached server or whatever you want for storing session data. The session file handler is just the default.
  • 0
    I mean, try them out and see which ones you're more comfortable with. None of them are really best
  • 1
    @Jilano 🤔I think I'm closing in on the whale you had before 😂

    Ok I'll stop... just right after this bucket of 🍿
  • 0
    @DubbaThony you're describing the difference between a CGI (or serverless) application and a full-fledged application.

    Doesn't PHP has frameworks than run and are statefull already?

    Well, to answer OP, I really don't like PHP but I also think it is more mature and you will find more resources for it.

    If you go with Node.js, just pick a node+express tuto on udemy/youtube and you should be ready to go.

    Actually, do it for both languages/platforms and decide by yourself!
  • 2
    Go with node as it uses JavaScript and learning JavaScript would be great as a developer
  • 1
    ASP. NET Core 🙃
  • 3
    Of the two, definitely Node.js (using TypeScript, fuck JS). PHP has the most retarded platform architecture imaginable
  • 1
    Just use java like a normal person
  • 1
    @tekashi I'm so so sorry
  • 1
    @ethernetzero

    dude, I KNOW. With extensions or externall things (like database is kindda external to php itself) you can do anything. Im just pointing out that this is major difference that php process finishes execution of request and it's done, while with Node JS you can make it so it can persist this data in variable in memory between requests.
  • 1
    PHP using PHP7. PHP 7.4 is coming and it's moving even further away from the shit that PHP5 was.
  • 1
    PHP is a programming language.
    NodeJS is not a language itself, its a platform.

    NodeJS is a platform which runs javascript on server-side and comes with some set of javascript functions, modules, helpers. Apart from that whatever logic you are writing is in JavaScript language.

    To understand and learn programming and web development concept you should learn both PHP and Javascript and then you can Jump to NodeJS.

    Check here further information or detailed difference between PHP vs Node.js: https://hackr.io/blog/...
Add Comment