DEV Community

Discussion on: PHP sucks, can it suck less?

Collapse
 
sandbird profile image
Sandbird

PHP is the best language out there. Whoever says otherwise is just crazy or just doesn't have enough imagination. You can literally do anything you can think of with it.

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

What the? I'm curious, what make you feel so strongly? There are a ton of fantastic lower and higher level languages to try, does it interest you to try something else. You might find the experience helps your writing better code in general.

Collapse
 
sandbird profile image
Sandbird • Edited

But of course i'm going to use other languages as well. And it does help in writing better code knowing other languages but I've used many languages both in web and game development (C++, obj C, java) and even various js frameworks like vue, nodejs etc but for some reason i always end up using php either as a backend or for logic and data manipulation and db interaction. Why? Because it is way faster, cleaner and easier to do all that compared to the rest. Try handling db queries with Vue, java or Obj C...and i am not talking about simple Selects here, but creating db queries based on user entries where you have tons of if/else/cases before deciding the ending query. I was working on a big project with a search form that had 50+ fields, combining 20+ tables, and 2 databases to bring back results. How are you going to handle all those cases if not with PHP? How many days would it take you to write that code using any other language?
Let me give you another example. My phone company gives me about 300min of mobile calls free of charge per month. It has no way of notifying me when i go over the limit (and why would they), so i had to think of an easy way of doing that myself. I wrote a parser that logs in my web account, checks my balance, uploads the stats in a db for a graph i made, then decides whether to notify me if i am approaching my limit etc via sms, email or push notification depending if my phone is under the same network or not. This thing uses crons, bash scripts, mysql, and also provides a GUI for various tweaks like check intervals the graph etc, all controlled via php. How long is the code? about 100 lines of code, done in a few hours. How would do all the above if not with PHP? How long would it take you, and how many different languages would you use?
You want another example ? There was a project that had a huge db of addresses that were stored in textareas (entries from an old system) and needed to have them separately each part in a different column, like zip code, address, area, country etc. There are some libraries out there that can do that, but you'd have to load an .so or .dll on the server first and that was not doable at the time. I wrote a parser that would break down a db entry into parts then try to figure out which is which using A.I algorithms to predict what is a street address, what is a zip code etc, and if it couldnt find or it wasnt sure about something, it would google it and then from the page results it will figure out if it's a city, a village, a country, a zip code, a phone number....whatever...and then act accordingly....yes..using PHP and it had 100% success at separating any entry you threw at it. I am sorry but how would you solve this problem using any other language?

Thread Thread
 
adam_cyclones profile image
Adam Crockett 🌀 • Edited

I am not a PHP hater, I am not a hater period. I don't know if I agree, because subjectivity, I feel that Rust is the best language out there... For specific reasons. PHP is probably the best server language for PHP based servers. As for your numerous examples. I don't understand really why a language like rust with a decent package manager could not achieve what you have described. You have listed so much it's hard to answer. But I could say this, where there's a package manager there's probably a solution in ANY language. I'm glad you like PHP but keep an open mind, PHP is not forever 😅

Collapse
 
sockmike profile image
Mike Smith • Edited

That doesn't mean anything and is incorrect. Sure, it is Turing complete but so is every programming language that is widely used. That says nothing about its power, features or sanity.

There are intractable problems that can not be solved mathematically(thus can not be done using a programming language - programming is math, this is a fundamental misundering amateurs such as all PHP programmers fail to grasp) therefore PHP can not do everything. No language can.

Still waiting for the well-educated PHP fan...

Collapse
 
sandbird profile image
Sandbird

Of course you are not going to be able to write an A.I program. No language can. All they can do is imitate intelligence by predicting stuff. But i dare you to try and do all that with any other framework you can think of without using PHP at least as an ajax receiver for DB querying efficiently and above all fast enough to do it all in one sitting.
All i am saying is, any idea that i had i was able to visualize and implement it with PHP much faster and more efficiently than any other language out there.
I've written custom web applications, web-to-game server interactions using sockets and db queries, very 'intelligent' parsers of all kinds, prediction algorithms, home automation scripts, obfuscators...you name it. The list goes on and on. PHP is used by 78.9% of all websites out there. You can easily hook up html, js, sockets or anything else you want into it really fast and test things out in a matter of seconds...when everyone else is still compiling.

Thread Thread
 
sockmike profile image
Mike Smith

You said "You can literally do anything you can think of with it." That is so wrong it is simply disproven and so shocking that only a PHP fan would write that.

Actually, AI is not on the list of intractable problems, if it were there would not be billions of dollars being dumped into it.

A basic and simple intractable problem is the Halting Problem, even a PHP fan might be able to understand that one.

That stat is flat-out wrong. Those stats will count a server that might have mod-php installed even if PHP is not running anything on it. Even if your laughable stats were correct, it would not prove anything other than there are a lot of morons out there, thankfully your stats are wrong.

I bet you consider Facebook to be a "PHP site" when all it is used for is template generation, none of the heavy work is done with it. Languages professionally designed(PHP is not designed in any manner whatsoever) languages is what runs the important backend stuff.

Using PHP has cost FB tens of millions of dollars and set them back years, that is probably a good thing since they are such a danger to the world.

PHP doesn't run anything important on the web. Not one thing.

PHP is dog crap, there is no technical merit, not even its fanboys can name anything technical that is good about.

Too bad PHP development can not even imitate intelligence.

Thread Thread
 
adam_cyclones profile image
Adam Crockett 🌀

This whole thread is crazzy 🤣.