Skip to content
Advertisement

Why is PHP considered to be the easiest web programming language to learn? [closed]

It is widely believed that PHP is the easiest programming language to learn for a beginner. The argument goes that PHP is the easiest language to use for getting a quick prototype up-and-running.

Why might this be? What, specifically, makes PHP easier to use than other languages?

Would this remain true, even when learning to use the object-oriented aspects of PHP? Or is it actually the object-oriented aspects of PHP that make it easy to learn? How does it compare with other web programming languages?

Advertisement

Answer

Conceptual simplicity.

A php site can consist of one file representing one page, with the dynamic content embedded within the static markup as needed. You can scan down a simple php file and see everything defined and run sequentially.

With a simple php site, there is no learning curve where one has to figure out in what file a specific piece of logic belongs, or in what external file a function has been defined.

Of course there is a reason that frameworks like rails provide lots of files and a fixed structure, and I would definitely recommend using one for any sizeable (and probably almost every small) site.

I do think though that it’s this very low barrier to entry that is responsible for a lot of php’s popularity.

I don’t think that there’s any reason a better php style system couldn’t be written in ruby or similar – think just directories and .erb and .haml files and nice 4.days.ago syntax. But most people who could do this see the value in the extra tools that a framework provides. Sinatra is a minimal framework, in which it’s possible to define an entire site in one file, but even it has routing powered by code instead of just directory and file naming.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement