Learn PHP Programming in Computer Scientists' Ways - The Inception


PHP is seen as a programming language only for web application development - though that is not the only truth. Some people are reluctant to admit that fact that it is a programming language at all. Most of the people out there think that PHP is a very ugly language. It has a lot of other bad reputations. But, at the end of the day we cannot go without PHP. I remember a guy from university who coded in Python for four years during university life and end up being a backend PHP developer at a company. I asked him why he left his passion and accepted what his world forced him to do - his face was kind of blank. Though it is not everyone's fate that all programmer have to use PHP but this is a good tool in the toolbox that will make life easier. Though it may not be obvious at first, but when you will spend almost a decade programming in different languages like me, you will surely admit that whether PHP be anyone's primary language or not, it is a good citizen in the world of programmers' tools. I code in different programming languages ranging from Java to JavaScript. C, C++, Java, Python, Ruby, JavaScript are on my most favorite list. But, that does not mean that I hate PHP. As an ever apprentice of computer science I think programming languages as tools, not as religions. Let's get back to where we were.

Majority portion of the ecosystem of the internet is built on top of this very very bad language. Oops, I just mentioned the world internet? (a lot of hissing sound in the darkness)

Why PHP has Such a Bad Reputation?

It all goes to the word internet! The people who say that PHP is an ugly language, in some cases including myself, say so because they were introduced to PHP for the first time with a web page development. Otherwise they should have thought C as a bad language too. And, they should have thought JAVA as a messy language (mess of classes and objects just to carry out a simple task), Python as a dumb language (because it gets mad when indentation is not right unlike other citizens). You know what, most of the people who frown upon PHP have Computer Science background.

In the introductory programming classes of Computer Science, students are taught to take inputs from the command line (that blank black window) and output to the same. They are taught different data structures and algorithms all with that boring blank black command line. When they are brought to the world of PHP, they are not taught in any way closer to the one mentioned above. They are taught to show a simple web page with the help of PHP. They are taught to take input through HTML forms and send output to browsers in HTML and less commonly in other formats. The teachers, instructors or guides do not go anywhere near data structures, algorithms and a lot of other necessary things. Again, to output Hello World on the screen it is not necessary to learn HTML. Programmers or computer science students are more interested in those blank black screens or sometimes in some GUI based environment. They 'can move they world' if you give them a command line.

So, doesn't PHP have stuffs like data structures, algorithms? No programming language can lack that! Cannot we do PHP programming in a command line environment? Yes, we absolutely can!

Are those everything why people hate PHP programming? No.

Many programmers hate PHP programming for a lot of other minor reasons. But these are the things for what people start to hate PHP programming. Many people say that PHP is not well architected. This is partly true, but over the years it improved. It has object oriented features now, but it is not object oriented at its core. That is another reason a lot of people hate it. I also have some degree of distaste in PHP for that reason - it's OOP feature is a bad hybrid. It was not created object oriented and we cannot expect it to be object oriented at its core.

If I continue to talk about many other disadvantages then the night will end but not the discussion. Again, other languages also have many drawbacks. So, let's stop talking about bad things for now.

Why to Learn PHP in the Computer Scientists' Ways?

The Right Way

Because that is the way we wanted to learn PHP, but the whole world diverted us. We wanted to learn the programming first and then web development with it. But the so called gurus made us to believe in the wrong ways. In the process we were mentally disturbed with the ever suppressed question why?, why this way?. So, I want to guide new PHP programmers in the right way, in the way they want.

Academic Programming in PHP

Computer science students want to do code academic stuffs in their familiar language. Many of them know how to code in PHP much better than they can code in any other language. Either they do not know how to code in PHP for academic things or they are afraid or shy to do so. In last few years I saw some students and acquaintances of mine to face the same problem. They were well expert in PHP but they could not go forward because they only did web stuffs in PHP. Again, I saw that they did not have any idea about how to do the same things in PHP that others are doing in C, C++, Java, Python, C#. I taught them how to code in PHP for academic projects and research. I realized that many learners around the world face the same problem. That was one of the most important thing that drove me to start this series.

Many Programmers are Expert in only One Language

Most people choose PHP as their first language because they can work with web stuffs. Web stuffs help make money quicker, and thus help make a secure future quickly. Also it can provide a guaranteed career (if not the best). People can earn living working with PHP. In that process many people end up being expert in that language. But they stuck when they go for academic or research related stuffs.

Who this Series is for?

Anyone who want to start in the right direction. You do not need to have any prior knowledge in programming or in PHP. Though it is not a bad thing if you have.

What I need to Start?

A curious mind, a computer of any kind with any operating system on which you can install PHP and run from command line.


This specific article was not for teaching you coding in PHP. We will do that from the next one in this series. In the next article I will guide you how to install and run PHP without installing anything extra, for example, XAMPP stack or Apache web server.