3 ms·
It’s fairly simple, with a syntax close to JavaScript that’s easy to pick up.
by muglug 7y ago
It’s fairly simple, with a syntax close to JavaScript that’s easy to pick up.
- milankragujevic 7y agoThere are many languages that are as simple or even simpler than PHP in syntax, and if you're comparing it to JavaScript, nodejs is literally JavaScript. PHP's biggest strength is ease of deployment and popularity. Deploying a nodejs app is a nightmare, because of the fact that nodejs isn't a web-first language in the traditional sense. It's a general purpose language that can do many things, but that causes problems for, i.e. hosting multiple apps on a single server (without having to coordinate ports between them, firewall them off, and have a single nginx instance proxying to them based on domain names). PHP is simple to deploy. If you have a shared hosting, just upload files to the FTP server, and open the page in the browser. It works. If you have a root server, just `sudo apt install -y apache2 libapache2-mod-php7.3` and put the files in /var/www/html/ It's a perfect fit for web because that's the only place where it actually works. It does one thing (platform) and it does it well (from the deployment perspective). It has (had) it's warts in the years, but I don't find many things that it doesn't have compared to other scripting languages.
- flir 7y agoThink you're underestimating the array functions. They might be ugly (programmers tend to prefer expressive array syntax), but their learning curve is the best of any language. So much of programming for the web is "do something to an array of stuff", and PHP makes that super-easy.
- wolco 7y agoThe built in standard libruary has everything you need. No packages are really required.
- wpearse 7y agoNot only this, but the Laravel PHP framework (such as used by Monica) makes it particularly easy to build and maintain such apps. Laravel is great for other things too — not just CMS-type-apps. It’s phenomenally good.
- milankragujevic 7y agoAgreed. Laravel is also fixing many of the complaints people have with PHP [developers], because it tries super hard to make you do things properly, and wherever it is possible, it actively prevents doing things the wrong way. It's really a breath of fresh air in the way it's laid out (IMO) and the documentation is mostly very good, with some areas (weird edge cases) that are lacking a bit, but it's quite usable. I'd recommend someone starting PHP to go with Laravel, and learn it's way of doing things. You can't go wrong and you will learn how to do things the right way. That's what I teach people. Also, this is excellent: https://phptherightway.com/ https://phptherightway.com/
- muglug 7y ago> it tries super hard to make you do things properly I don't have much experience with Laravel, but my sense is that Laravel tries to make hard stuff (CRUD operations, MVC) easy, but it doesn't try so hard to make you do things "properly".