Web Dev Notes

Blog about web development by Robert Dawson

A few advantages and/or disadvantages of PHP

 The biggest strength of PHP for me has always been that it's free, in contrast to a language like .NET. For example, I used ColdFusion and ActionScript both for years, but only because someone else, namely, my boss at the time, paid for the necessary software to use them!

Another strength of PHP for me has been its relative ease of use and learning curve. For example, for better or worse, I have rarely felt the need to write classes, whereas I have with a language like Java or Apple's dark underbelly, Objective-C.

Maybe I should blame my art background, but I have generally enjoyed the simplicity of loosely typed languages. At the 2013 SF HTML5 Developer Conference, for instance, I found myself nodding in agreement when Douglas Crockford reaffirmed his overall praise of JavaScript's loose typing, even at the expense of having a single "number" type.

However, I also found myself scratching my head a bit because I kept wondering if it might be better to better organize a loosely typed language like JavaScript, since, at least in JavaScript's case, it's not so good at counting. And I find that, as I continue to write code, whether PHP or CSS, I tend to want more structure, especially if it promises reusability.

So, I suppose I see PHP's loosely typed structure as both a strength and a weakness, for more speed and less stress, respectively.

One last weakness of PHP that I should mention, keeping in mind that this might simply reflect my ignorance of available options, is the ease of generating documentation for PHP code. I have used phpDocumentor, for example, but also found annoying problems, like when each of the generated HTML pages starts with an error about not specifying a default timezone. Is this really that hard to eliminate this error?

Here are some relevant discussions I found today:

What are some of the advantages of PHP over other programming languages?

What are the horrors of PHP?

Strengths and Weaknesses of various programming languages

But, however good or bad, by whatever measure, PHP seems to a given developer these days, it does remain a popular choice. 

How to use phpDocumentor on WordPress (on Mac)

Here are the steps it took for me to get phpDocumentor to create documentation for a WordPress installation.


  1. Open phpDocumentor.ini*
  2. Uncomment the line (line 25 for me) starting with "memory_limit"
  3. Set memory_limit to "2048M"**
  4. Open Terminal and go to the directory above the one your wordpress installation
  5. Use phpdoc (takes a few minutes)


phpdoc -o HTML:frames:earthli -d wordpress -t wordpress/docs

* I'm using MAMP and my directory is /Applications/MAMP/htdocs/phpdoc/.
** Probably overkill; consider available RAM. For me, 1024M wasn't enough. I kept getting this error:

phpdoc FAILED: Bad environment variable $PHP (set to "/usr/bin/php")