DEV Community

Cover image for PHP... yay or nay?
lizziekardon
lizziekardon

Posted on

PHP... yay or nay?

We usually see two camps:

  1. PHP is way better than it used to be, and huge sites still run it (Facebook/Wikipedia, etc...)

  2. PHP always sucked... anything is better.

I want to know, which side are you on? What your thoughts on PHP?

@jacobian for scale...

Latest comments (30)

Collapse
 
k_penguin_sato profile image
K-Sato

dont do php but hey why not?

Collapse
 
ssimontis profile image
Scott Simontis

As the guy who generally ends up sysadmin for PHP sites, I don't like it. So many fun performance issues to hunt down, so many security flaws to worry about, I never feel at ease when I am in charge of a PHP server.

Collapse
 
peter279k profile image
peter279k

I've used the PHP 5.3 to PHP 7.0+ versions.

And I also use the Python 3+ and JavaScript.

I think it's fine for using the PHP, but it's not good for some developers.

Why? At most of time, I think junior/fresh PHP developers need to concern and learn about how to use correct PHP syntax/approaches to accomplish PHP developments/works.

If not, some senior PHP developers will anger and mad at them :-).

Collapse
 
juyn profile image
Xavier Dubois 🇫🇷

I may be in love with PHP, so I won't tell you why it's a big YAY, but:
stitcher.io/blog/php-in-2019

Collapse
 
danjconn profile image
Dan Conn

I have not used PHP since PHP 5. I have heard it has improved a lot. Even in PHP 5 I built some very simple things and some enterprise scale fully automated systems.

My main issue with PHP is also it's strength. It's very easy to get going.

It works as a positive in that you can get results quickly with little knowledge.

But this is also a negative because you needed to know a lot about the language anyway to ensure you were using it safely.

For example knowing which one to use out of mysql_escape_string, mysql_real_escape_string, or msqli_real_escape_string relied on you knowing which one was safe!

I know the offending ones were removed from PHP 7, but still, newcomers drawn to its ease of use may not have been aware of this (are there other examples still around though?).

I think if you know what you're doing with it and are sure you understand the pitfalls then great, for me personally, I'm happy to stick with Java and Python for now :)

Collapse
 
makiten profile image
Donald

I don't really mind it, but I hardly use it anymore, since I can accomplish my tasks with other languages. I use languages I don't like (JavaScript) all the time, so the main reason I don't really do PHP much anymore is because there aren't jobs asking for it. 10 years ago, they did, but it's far less common except in the local startup scene where the pay for PHP is woefully low.

Collapse
 
vlasales profile image
Vlastimil Pospichal • Edited

PHP is way better than it used to be. OOP is perfect, database connectors too, super modules for maintaining XML, JSON, CSV,...

PHP is not just one language. I use SQL, XPath and XSLT in it as well. This combination is very cool and speed is like on steroids.

Collapse
 
samuraiseoul profile image
Sophie The Lionhart

OOP in PHP is not perfect. For instance, an interface can define the constructor's signature.

interface Foo {
    public function __construct(SomeDependency $someDependency);
}

This isn't allowed in most languages(maybe any others) and is pretty against SOLID principles.

Collapse
 
vlasales profile image
Vlastimil Pospichal • Edited

This is not against SOLID principles. Simply I don't use it.

Collapse
 
_ezell_ profile image
Ezell Frazier • Edited

I started off with PHP, but prefer Node over it and just about anything else imo.

The pros of PHP as well as just about any other server-side language over Node is short and sweet; better built-in methods. String methods, object methods, etc.. JS is rapidly catching up here, but if I found myself wanting more for less, I'd probably move over to Python.

Anyways, PHP is fine for most use-cases, but I've come to love Node for a few things:

  1. NPM (there's just about a package for anything)
  2. The .js file IS the server (no need for Apache/Nginx)
  3. TypeScript
  4. Inherently asynchronous (it takes a lot for the server to block requests)
  5. It's generally the default/starter tech for cloud function services (firebase)
  6. Native server-side rendering support for front-end libraries (vue, react)

The combination of the above points are why I struggle to find much of a reason to use PHP or any other server-side languages.

But if the use-case is to simply model and serve content, just about any language will do the job, including PHP.

Collapse
 
lizziekardon profile image
lizziekardon

pagely is hiring for a jr/mid php dev if any of y'all are looking: pagely.breezy.hr/p/7683b0feb31c-jr...

Collapse
 
aminnairi profile image
Amin

Daily Node developer here. Sometimes I miss PHP for its meta programming game that is way better than JavaScript IMO. That's why there are awesome Frameworks like Laravel which I use for my personal projects. I tried to write a tool to generate GNU Linux i3bars in PHP and it was so easy to add features but when I started adding asynchronous programming it became a lot harder than I though. I finally used Node but its OOP is not on point compared to PHP. There is no better language, it really depends on the situation. I sometimes overheard people saying that PHP sucked but as for any language I honestly think that no language suck, what makes us think that is because we didn't choose the right tool for the job. JavaScript has a better set of tooling for functional programming than PHP for instance.