Why php is horrible




















Over time with PHP 5 it became fully object-oriented with 5. PHP 7 was a major improvement, both in terms of performance, language syntax, concert defining and so on. But when you think about the popularity of PHP as a programming language, consider the past 15 or 20 years, if you have been around, or at least if you know what happened 15 to 20 years ago.

What I remember back in the day when I was a young kid playing with tech, we wanted to set forums because forums were the thing after bulletin boards and some other things. You want a gallery? No problem. E, a bunch of other platforms, Mambo, which was the predecessor of Joomla and so on. In terms of performance, in terms of stability and so on, PHP has been proven to work. So almost all platforms out there that were solving business problems were based on PHP because PHP was easy to learn, it was easy to tinker with because those platforms were open source.

It played extremely well with MySQL, which was the most popular open-source, well free database platform out there. It is a programming language with a long history, which involves a number of outdated solutions. It lacks grace, consistency and is no longer state-of-the-art. However, it has a fundamental advantage: you can solve almost any problem with it. The more restrained ones concern the sense of further existence of PHP at a time when Python, JavaScript or Ruby are leading in popularity rankings.

On the one hand, authors of such posts can be accused of trolling. On the other hand, this type of "provocation" has a certain benefit, it contributes to the discussion on the value of PHP against the background of increasing competition. PHP was created in by Rasmus Lerdorf.

The initial version of this language was a set of Perl scripts, which was used by Lerdorf to monitor traffic on his website. As the number of visitors increased, the developer rewrote the scripts in C-language, adding more features, and in he released the source code of his work.

PHP quickly gained popularity and became a global project. By it was used by more than 50, software developers around the world. PHP is a general-purpose scripting language. However, it is primarily designed to develop dynamic websites and web applications.

According to data from August , It has also been used to develop a large number of web applications, such as content management systems, discussion forums and database clients.

People hate PHP because its syntax is terrible, it refuses to adapt to changes in the way programming is done, and yes, it was terribly and inconsistently designed from the very beginning. Now that being said, even the crappiest tools can be used to make nice software. Laravel is proof that even PHP can shine when used in a modern way, but developers still hate it because you have to actively fight against the language, the built in functions, and the terrible ecosystem in order to get anything done.

A built from scratch! I never knew it was hated so much. The same people struggle with javascript frameworks too so you know maybe its the person. Bashing PHP has become more of a meme than the language actually having issues and people only replicate without knowing it throughly. I love PHP build mp3tager. I was a resident of a country where. Net is the only language there, at that time all I knew about PHP that it is a junk, many years later I moved to a new country where they only use PHP, I used all tutorials to quickly learn it in order to find a job, it was PHP 7 and in two months I was able to make my first web app with php, now I feel I forgot all about.

I am involved in php development since from 10 years. And surprice that there is no discussion of Yii2 framework which make it more strong. The epilogue applies exactly to Perl 5 which got the same reputation.

Switch with 25 cases I saw 6 years ago, functions with 11 parameters used in the code logic of pricing I saw just last summer.

This logic was so bad, it took me months and I was unable to fix it because of side effects and breaking elsewhere. I have bad memories from it, to the level of twisting my stomach when I think about it. Nice article. Thanks for telling arguments of both opinions. I was a Java developer that wanted to move to web developer. You can do terrible things with them, but also with pretty much everything. PHP7 was a big step forward.

There are no bad languages, only bad coders. Developers usually prefer the language they are most proficient in, but a skilled coder will figure out how to write good code in anything. Languages that are inconsistent and poorly designed get better as skilled coders grow good practices and suggest improvements. Languages get passed up by others that are evolving faster and address current requirements more easily and eventually fall into disuse.

PHP is typical. If PHP were to be released today, noone would use it. If i need easy concurrency, i will use Go. This blog can be written in PHP with any problem because it is very basic.

Huge application, in which speed and concurrency is required overrun what PHP can do. Is the New York Times a simple blog? What about tech crunch? How about the New York post? Your argument makes no sense. All of these huge sites who have millions of visitors a day not only run on php but run on WordPress.

However that is not the case and in fact many of the newer language probably would not exist at all were it not for PHP. I hate PHP because my cloud hosted. Comparatively speaking, a simple request that hits a database at least once usually takes about 10 times as long on PHP as it does with.

Net Core. So leaves me with one final conclusion …. And other programming languages too. And take into account that many technologies can solve the SAME problem. Hire an engineer. You have nailed it. People hate it because, they think that, hating it makes them look cool. Your blog certainly helped me. PHP was a fun project that turned into a messed up mainstream hack. It can go bad a LOT faster than the previously listed languages. If you are stuck with a PHP project, I understand the pain.

It really depends what you want to do with your life. And no, I don't have to work with php. Employment opportunities are no lacking. I'm not even looking and people come at me on a weekly basis. So when I see a job posting with php, I just pass.

A lot of other top-notch developers will pass too. And whoever is stuck with that php system will find a dwindling of talent willing to work on it. That will make anyone who wants to do something serious reluctant to have their devs do it in php. And its also the sad truth about it, php doesn't suck, its just not as good as the alternatives… unless you're making Uncle John's website… And whoever is really serious about their work will want to use the best tool they can and the demand for devs is high enough that they won't have to compromise on this, they will find an employer who is also serious enough to offer them to work on the best tools they can find.

PS: I'm way too busy with my career to help uncle John with his website even as family. My downtime is precious. Its not, Javascript is the most popular Web languages. A lot of charts will also put Python above PHP. It is supported by an ecosystem of projects around it.

If the ecosystem is not strong, the language will be of more limited use. Look at reactive programming number of stars and contributors. Want do devops? From the start, PHP has been designed with beginners in mind whose sole goal is to create simple, database driven websites. Of course, this is totally fine except that it grew too large over time. Apparently, way too less brainpower has been invested into scalability or into anything during the probably non-existent design process.

There is nothing wrong with a language that is designed for small-scale applications, but what PHP has become and what it is being used for is clearly far away from all intentions during its inception — a personal toolkit for its creator. PHP uses the dynamic typing approach with types being determined at runtime based on how they are used in any particular situation.

Variables are created and initialized whenever they are used for the first time, which is just bound to result in errors that are caused by typos. They are not just numerically indexed but actually a freakish crossbreed of pretty much everything and can be treated as an array, list, hash table, dictionary, collection, stack, queue, and probably more.

Before classes were added to PHP 4, there were no other data structures. The same goes for other primitives. Be prepared, you will face hard-to-detect errors that will make your life miserable. Well yes — except when it comes to classes as parameter types for functions and methods.

To be specific, I mean classes only. Consider this declaration:. The function must be called with a valid instance of SomeClass. Actually, there is an experimental concept called SPL Types that allows type hinting with basic types. Apparently, creating a wrapper class for basic types in order to achieve basic functionality seemed to be a good idea.

Take a moment to reflect on how non-retarded programming languages handle integer overflows or underflows for that matter. I can think of three main approaches to handle such scenarios and give you one language each:. C will throw an exception indicating the overflow, given the operation was carried out within a checked block.

Ruby features type promotion and automatically switches to arbitrary integers to deliver the correct result. Now PHP follows a completely different approach.

Instead of doing something sensible, it automatically converts the value to float. Let that sink in for a while. Even worse, there is no easy mechanism to detect such overflows. PHP does not support unsigned variables. Of course the inconsistency mows everything down here too. PHP code is both case-sensitive and case-insensitive, depending on the specific identifiers. In PHP, variables, constants and array keys are case-sensitive.

The same rule goes with class member variables and class constants. However, keywords, functions and methods are case-insensitive. While this might not be a big issue, it may still cause problems when using autoloaders on case-sensitive file systems.

Another problem that commonly arises with languages that are not type-safe is dealing with type conversions while using operators. Normal languages clearly define the behavior in a logical way, however, PHP is a special case again here because the outcome seems to be pretty much unpredictable. Actually, let me give you a humble advice at this point:.



0コメント

  • 1000 / 1000