Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
myss45285yLolled at this, imo Symfony and PHP 7 are awesome and they really try to implement best practices and patterns that make sense.
Since Symfony 4 and autowire it's absolute joy to develop systems in PHP.
As you said, don't form opinion on something you've never used, especially from a bunch of people whose furthest range was to work in Wordpress. -
What @alexbrooklyn said, plus the guy who made it will confidently say things at conventions like, "multi-threading is too difficult for humans to understand" as an excuse for why PHP doesn't really do it. He comes off as an opinionated hobbyist, and it's really, incredibly hard for me to respect that attitude, despite his accomplishments.
People make stuff with it, people are happy with it, and that's great. It, its creator and its community have just done so much to rub me the wrong way every time I tried to dip an olive branch in, so I choose to nop out and be like you: "no strong opinions," other than it's not for me. -
myss45285yHmm okay, so why not just google PHP vs Python vs Nodejs vs Ruby and/or whatever you're interested in? I'm pretty sure there are bunch of articles there that have it explained in detail much better then anyone is gonna answer you.
And it's not about which one is better designed, they all have their ups and downs, it's about finding the best one that fits your needs.
Otherwise we would be writing websites in binary.. -
myss45285yAlso since I'm in a good mood, I'm gonna give you an example for above:
Write application with NodeJs and any of its ORMs, have fun scaling that to anything above several entities, the code is gonna look hideous, let's not even talk about more serious features like validations, auto-generated documentation and query builders.
On other side from top of my head, try handle data via websockets in your PHP application and you're gonna have large pain in the ass.
Another example, if you gonna argue by design complexity and features, there is probably not a language that can match C++. Try and serialize a simple struct to JSON in it and then compare how hard it is next to PHP, Typescript or mostly any other language used for web development.. -
@Yujiri
The most common reasons are business-driven:
1. You already have a large dev staff that uses it
2. You can't justify retroing a legacy codebase
3. You want to outsource to a cheap shop to deliver your MVP asap ( a lot of them use laravel )
4. Your area is short on devs for other platforms -
I think a lot of the arguments stem from trying to compare apples and bananas....
PHP is a scripting language. It has an extension system and yes, there are OS / system specific extensions Like threading / SHM and so on. But that was never the focus of PHP.
One of the reasons I love PHP for tooling is PDO. It's a very good abstraction and takes away a lot of the pain points when working with different RDBMs.
It's OOP features and the stricter typing are new... So yes. It still suffers from it's early days - eg inconsistent function parameters / naming, not having ASYNC / threading and so on.
But when you don't need that, it's a reasonable choice imho.
You shouldn't choose a language because you like it, you should choose it because it can fulfill your needs.
I eg use PHP mostly for DB tooling / report generation and so on (no framework).
Python (no ASYNC ;)) for system tooling, eg SSH / Partitioning / VM management / automation.... -
wannabe5325yLanguages do things that they are built for well, can do most forms of data manipulation ok, and are terrible at doing things they were not designed for.
At the end of the day, its a layer of abstraction which doesn't give a fuck whether you like it or not :D -
C0D4681455yLet me just stay with a 🤦♂️🤦♂️🤦♂️
Ok, now that that's out of the way, let's get for a walk down memory lane.
PHP was the alternate scripting language back in the day to ASP (pre C# days) so from that it grew up with a community that has poured a lot of time an effort to make a programming language from what was a bunch of cgi scripts.
From there, we entered php4, which is the period of "hate", this is where shit when sideways as php was a trainwreck compared to other languages at the time, it allowed you do anything you wanted, and it would do its best to actually run. It never enforced design patterns or coding standards, and to this day still makes these optional.
PHP5 days were when things started to improve, but with the reputation of a dirty whore on the corner, a lot of people had already moved away but kept their opinions.
PHP 5 introduced classes, namespaces and allowed us php devs to work in a realm of OOP and MVC to some degree. It also introduced mysqli (improved queries) that prevent a fuck tonne of sqli (sql injection) as most php devs didn't and still don't write safe queries, mysqli was quickly pushed to the side when PDO became the norm.
From here, PHP7 came out and fuck did things get faster, I can now write code and execute it at reasonable speeds compared to other languages, more work has gone into the OOP side of things with type safety being introduced.
Why is php still hated by the masses?
Because even though php4 was 20 odd years ago, it got that persona as being old used hooker and we now live with it.
Personally, I've seen php grow over the years, and it's still my go to language for anything I develop.
I also work with python and java but only when I can't achieve what I'm doing in php.
@SortOfTested mentioned multi-threading, she's right, it's a royal pain in the ass but it can do it with some elbow grease being applied. -
C0D4681455yHmm I ran out of lines.
Why would I use php over other languages today?
It's speed it's now up to par with python, and in some situations actually faster.
It now has strict type safety, making the code safer overall instead of initiating variables as arrays, replacing them as strings, and then using the same variable again as a database result set... I've seen some bad shit in my life.
I've invested a lot of years into php working around it's quirks and there are times I still go "how do I use this function" array_ and str_ functions are the worst for naming and argument ordering but what ever, no language is perfect.
I can write a quick and dirty script in a few minutes and run it just as fast, or I can spend a great deal of time implementing a large project with it, it can handle a lot of different scenarios.
It's scalable with ease, need another server? throw up a load balancer and away you go.
With the use of PDO, I can interact with a range of different database servers instead of being tied down to 1 or having to compile db drivers into my codebase (looking at you java) -
I think the biggest problem of php are the devs themselves, there are some good devs but most of them do horrendous shit that should be classified heresy and should be punished with a short drop.
-
hjk10157315yIt's easy to learn, flexible, mature and highly backwards compatible. Relatively fast for the high level of abstraction. It's build in functions are vast making it a general purpose language. You can easily manipulate data, work with csv, xml, manipulate streams, do socket io and of course work with databases.
With composer there is a whole load of additional quality code you load. The problem is though that because it is so easy and so backwards compatible (a lot of the inconsistent parameter stuff you read about actually comes from the C library equivalents) you can still find more crappy code and programs in PHP.
This has nothing with the language itself. It has evolved nicely. Has a good eco system.
I use it for most things REST (communicating with all kinds of services is super easy especially if they provide an guzzle based SDK) most things database. Would not use it when any concurrency in the same process is desired though. -
good design ideas as what? opposed to Golang?
C0D4 covered already much of what I wanted to say.
Adding to what he said. Think of language evolution. It doesn't matter that it started as a language that was used for templating over html markup. What matters is that it has evolved, think of the language as you would any other scripting language worth functional and oop support, all design patterns used in java and c# I have carried over to php with no problem, so architectural structuring is not a problem. Speed? we got that in spades, safety features have been included into the language to prevent us from doing the horrors we did in the past.
of course people will like that it helps them build websites fast....its what it is meant for. if you want ml go python or Scala.
What feature do you have in mind or knowledge of interpreter/compiler design that would be worth mentioning in the internals of the language? -
With projects like Phabricator my respect to PHP doesn't fade out, especially knowing from experience that it somehow saved my ass in past. But I despise using it without framework like Symfony. Actually, that same rule can be applied to any language, even Node.js. Important thing is, people take it seriously and make success, why not!
Related Rants
I've heard a ton of negative opinion on PHP, which I've never used, so much that if what I've heard is true I wonder why anyone would use it. I asked on dev.to whether there are any real good design ideas going into PHP and got 5 responders. They were all to the effect of "PHP is great because PHP can make websites". I think that says something about the number of good design ideas going into PHP. I'm uncomfortable forming a strong opinion on a language I've never used, but I've never seen signs this bad.
rant
php