Skip navigation

I was looking for a way to zip files with PHP just a second ago. I need this to implement a feature in the website. 🙂 It happens that PHP V5.2 has the ability to create zip files. Awesome.

But as I searched for what I needed I got derailed. I saw a message that said PHP is a “language for beginners”.

I strongly believe that that is very bad advice. PHP is a language that is easy to get started in. It is not easier than any other language to actually program properly. It is harder. It’s easy to program bad code in PHP because it so often lets you, and as a consequence many say that PHP is a bad language.

I believe PHP is not suitable for beginners, but I don’t think it should be labeled a bad language. Just because PHP lets you write bad code does not mean you should do it. A loose analogy: If you have a Ferrari it will let you drive at 300kmh (185mph) in a 50 zone. It would be irresponsible to do that. But would you argue that Ferraris are bad because it lets you go that fast? Maybe, maybe not.

And because PHP is so accessible to such a wide audience there’s so many (bad) tutorials and books out there to derail otherwise well-intentioned beginners. An example is Beginning PHP5, Apache, MySQL, Web Development. Read it if you want but I highly recommend to avoid it because it seems like most of the code in the book is just horrible spaghetti code. I’m only singling out this book because its one that I’ve read. If you really want to learn PHP I highly recommend to try looking in a University bookstore/library for the more academic titles, instead of the local bookstore.

Although having said that about PHP, I want to make it clear that ultimately good code results from careful thinking and training, not from the language. It is also important to understand that bad code can be written in all languages. Other languages like Java or Ruby have more constraints that help a programmer avoid some bad practices but they aren’t going to instantly result in good code being produced.

EDIT: Fixed up some sentences to make the article flow better, esp. last paragraph 🙂 I don’t think I’ve changed the meaning of anything, just made things clearer. In the future I’ll plan my articles better to avoid having to do this much editing …

Advertisements

3 Comments

  1. PHP is a web-oriented language, so there is no need to compare it to other languages. Now what is “bad code”? Everything depends on a person and his skills as a programmer. I think the language is good for beginners. It is not overloaded with stuff beginners are usually afraid of, like C++, for example. It allows you several ways to deal with the task. And as it is way simpler than other languages, I think it would be better to start off something easy.

  2. I would suggest that PHP is a great language for beginners, I think you’ve just had a bad experience.

    PHP will indeed teach some bad habits (Such as not declaring variables) – but this is easier than declaring them is it not?

    Anyways, I gave you an extra Digg. Found it after posting my own:
    http://digg.com/programming/SQL_Injection_Prevention_Learn_PHP_Online

    Check it out 🙂

  3. i agree with gf4e. php is great for beginner web development. There are bad coders in every language not justphp.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: