PHP developers, read this: “If PHP Were British”

When Rasmus Lerdorf first put PHP together, he – quite sensibly, despite his heritage – chose not to write it in Greenlandic or Danish. Good job too – that would have been rather unpleasant to work with. He opted instead, being in Canada at the time, for the local tongue. No, not French – that bastard dialect of the Queen’s English commonly referred to as “US English”.

PHP developers in Britain have been grumpy about this ever since. What was he thinking? And more importantly, how do we undo this travesty? How do we developers ensure the traditions of the British Empire continue to be upheld, even in the digital age?

A Slap in the Face

  1. $variable_name

The first, but maybe the most important, of many changes that will allow PHP to achieve a more elegant feel is to remove that symbol so beloved by the US and replace it with something altogether more refined. More solid. More … sterling.

  1. £variable_name

(…)

[SWITCH]

  1.     switch ($variable) {
  2.     case $option1:
  3.     //Code here
  4.     break;
  5.     case $option2:
  6.     //Code here
  7.     break;
  8.     default:
  9.     //Code here
  10.     break;
  11.     }

Words such as “switch”, “break” and “default” are hard on the reader and lack context. The Right Honourable biggerthancheeses was kind enough to contribute a more gentrified suggestion (and has some interesting ideas, particularly around replacement of “include()” with something like “i_might_be_partial_to()”, demonstrating a natural talent for the Imperialisation of programming languages):

  1.     what_about (£variable) {
  2.     perhaps £possibility:
  3.     //Code here
  4.     splendid;
  5.     perhaps £other_possibility:
  6.     //Code here
  7.     splendid;
  8.     on_the_off_chance:
  9.     //Code here
  10.     splendid;
  11.     }

(…)

[TRY/CATCH]

  1.     try {
  2.     // Code here
  3.     } catch (Exception $e) {
  4.     // Handle exception
  5.     die(‘Message’);
  6.     }

The try … catch block is an excellent example of PHP’s lack of manners. Far too direct to be allowed in the new PHP. Additionally, the word “die” is so very depressing. This new block, although more verbose, is vastly more polite and upbeat:

  1.     would_you_mind {
  2.     // Code here
  3.     } actually_i_do_mind (Exception £e) {
  4.     // Politely move on
  5.     cheerio(‘Message’);
  6.     }

(…)

>>>>>>> Read the full article on addedbytes.com

Advertisements

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: