this post was submitted on 01 Sep 2023
337 points (96.2% liked)

Programming

17503 readers
8 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 8 points 1 year ago (1 children)

It's just that it's an ugly and weak language, overly verbose, and riddled with inconsistencies. There are few good things you can do in PHP without huge frameworks.

[–] [email protected] 2 points 1 year ago (1 children)

Not sure what qualifies as ugly but I find PHP codes much easier to read than JavaScript (if that is what you meant)

If with weak you mean weak typed then you're partially correct: most of it can be typed and ever since .. I dunno, years ago, I've worked exclusively with strict typing. Things have improved considerably on that front

What part is verbose? Genuine curiosity

The inconsistencies are true. It's also PHP's strength that they kept everything like that and kept everything compatible. Every JavaScript framework I have worked with caused the weekly update nightmare headaches where 5 bugs were resolved, but now 10 more were added due to changing method calls. I hated it and I love PHP for at least keeping that consistency. Over time they have worked little by little to mitigate things but at the core, yes, you have function call inconsistencies. However, good editors these days for that for you and tell you the function name and give you the parameter order.

Then that there are few good things you can dowithout frameworks is nonsense.

If you want to do it right you use a framework, but that goes for every language. But I've sen and worked on (admittedly a horrible) system that would scrape millions of pages per day and its first version was just hacked together code. Ugly but super quick and simple, no frameworks. I've built many similar systems and sites like it over the years.

Now I recently built my own new framework in PHP, all strict, and it's just fast and beautiful

[–] [email protected] 5 points 1 year ago (1 children)

You're comparing to only JavaScript, have you worked with another language like python, ruby, lisp, rust? Maybe then you'd see what I mean.

By verbose I mean that mostly PHP lacks syntactic sugar, mostly it lacks powerful features of other languages. You can mostly write very simple procedural code.

[–] [email protected] 1 points 1 year ago (1 children)

Well I compare to JavaScript because that's what most people bring up. On web development, I guess JavaScript is the biggest competitor.

I've worked with many languages. I even worked with assembly for a while in another life over 25 years ago, I worked with visual basic, .net, c, c++, Java, JavaScript and it's many frameworks, loads other more obscure languages too, and I've played with some python over the years. Still though, php has my favorite since a loooong time

Can you give an example of missing syntactic sugar or features that are missing?

[–] [email protected] 1 points 1 year ago (1 children)

Type hints and comprehensions as in Python, borrow checker, traits, code interface checking in Rust. Most functional features.

IDK; I just don't like anything about PHP and I have worked with it. It seems bad at every task.

[–] [email protected] 1 points 1 year ago (1 children)

Type hinting? There. Traits? There. Interfaces? There. I could go on but PHP has all these features that people keep saying are missing.

I'm not saying you don't have to like PHP, everyone likes there own labgua and that's fine.

However, people keep making shit up about phpt and then use that shit to smear it and it's annoying. PHP is great for web sites, small and complicated, it's great for command line scripting, it's great for a large list of tasks and it seems that what you need is there.

[–] [email protected] 1 points 1 year ago (1 children)

It doesn't really count if you need a huge framework for it. Frankly I never saw PHP used well, and I never saw it do anything better than other languages can do.

[–] [email protected] 1 points 1 year ago

It doesn't need a huge framework for any of the things I mentioned.

I use my own (rather small still, really) framework to make things easier, like you'd do for any larger projects.

But I can (and have) on many occasions just slap something together as well