• Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
  • Skip to footer

Coding Still

  • Home
  • About

If PHP Were British

August 20, 2011 By _tasos Leave a Comment

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

$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.

£variable_name

Abbreviations

Few things are more abhorrent to the British than unnecessary abbreviations. “Text speak” is unheard of on the streets of London, as the natural ingrained British grammarian simply refuses to stoop to sending messages of the “c u soon traffic kthxbye” variety, instead proferring something altogether more elegant: “Dear Sir/Madam. I will arrive as soon as time allows, which I expect to be within the hour. I assure you the horses shall not be spared. Yours respectfully.” (slower to type, yes, but we do not like to be rushed).

PHP, on the other hand, is full to bursting with abbreviations and acronyms which are entirely unnecessary:

str_replace()
is_int()
var_dump()
preg_match()
json_encode()
mysql_connect()

The following changes should improve things:

string_replace()
is_integer()
variable_dump()
perform_a_regular_expression_match()
javascript_object_notation_encode()
my_structured_query_language_connect()

Eloquence

if ($condition) {
// Code here
} else {
// Code here
}

Shakespeare would be ashamed to see his native tongue twisted into this monstrosity. Brevity is to be applauded in the right context – in some dark corner, where it shall be seldom seen – but not here. The if … else block is the most used conditional code in all of PHP, so it must be made as inoffensive as possible. There are many options for its replacement, but this may be the strongest:

perchance (£condition) {
// Code here
} otherwise {
// Code here
}

Spelling

imagecolorallocate()
serialize()
newt_centered_window()
connection_status()

Words fail me at this point. How is any self-respecting gentleman expected to make head or tail of these “words”. It beggars belief that anyone could allow such distortions of words to be entered into a programming language. They, along with the myriad of similar errors, should be reverted to their proper forms immediately:

imagecolourallocate()
serialise()
newt_centred_window()
connexion_status()

Manners

try {
// Code here
} catch (Exception $e) {
// Handle exception
die('Message');
}

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:

would_you_mind {
// Code here
} actually_i_do_mind (Exception £e) {
// Politely move on
cheerio('Message');
}

Class

Perhaps nothing is as important and ingrained in the British psyche as the notion of class and, while there are few opportunities for change within this part of PHP, the changes that there are to be made here are important.

class Republic {
public $a;
private $b;
protected $c;
}
$example = new Republic;

To begin with, the current system has no place for class hierarchy and this is unacceptable. So we shall begin by giving classes specific levels – upper, middle, working – and no class can access the methods of one of a higher level without the explicit permission of the higher order class (of course, though it might then have access, it would not be a true member of the higher order and could not itself grant higher order access to other lower order classes). “Public” and “Private”, in the British class system, are often synonymous (see, for example, school system nomenclature), so these must be adjusted, as should the “Protected” property visibility. The word “new”, while passable, has a much more appropriate replacement in matters of class.

upper_class Empire {
state £a;
private £b;
hereditary £c;
}
£example = nouveau Empire;

The Sun Never Sets …

It is hoped that these few simple changes will improve the reputation and status of PHP among other languages. No longer will it be the poor American cousin – instead it can take its rightful place as the – British – King of the scripting languages.

Original Article: http://www.addedbytes.com/blog/if-php-were-british/.

Filed Under: Fun Tagged With: PHP

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Categories

  • .NET Development
  • ASP.NET
  • Databases
  • Fun
  • IIS
  • JavaScript
  • Web Development

Tags

.NET Core Android ANTLR ASP.NET Ajax ASP.NET Core ASP.NET MVC ASP.NET Web Forms AWS Bouncy Castle Chartjs cli Client info detection Comic Continuous integration CSS Data backup Date handling Firebase Firefox addons Github HigLabo HTML5 Image manipulation jQuery JWT MySQL Nodejs Nuget OAuth Objectionjs OOP openssl Oracle ORM PHP Regular expressions SEO Social media SQL SQL Server UI/UX Url rewriting Videos Visual Studio Web design

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Secondary Sidebar

Archives

  • July 2020
  • March 2020
  • August 2019
  • December 2018
  • November 2018
  • February 2018
  • August 2016
  • June 2016
  • May 2016
  • February 2016
  • January 2016
  • August 2015
  • July 2015
  • October 2014
  • July 2014
  • November 2013
  • April 2013
  • February 2013
  • January 2013
  • December 2012
  • November 2012
  • August 2012
  • May 2012
  • February 2012
  • December 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • May 2011
  • April 2011
  • March 2011
  • February 2011
  • January 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010
  • August 2010
  • July 2010

Footer

Recent Posts

  • Anatomy of an Objection.js model
  • Check your RSA private and public keys
  • Round functions on the Nth digit
  • Send FCM Notifications in C#
  • Jwt Manager
  • Things around the web #5
  • Query JSON data as relational in MySQL
  • Create and sign JWT token with RS256 using the private key
  • Drop all database objects in Oracle
  • Create and deploy a Nuget package

Latest tweets

  • Things I Wished More Developers Knew About Databases https://t.co/h4gfq6NJgo #softwaredevelopment #databases May 3, 2020 12:52
  • How a Few Lines of Code Broke Lots of Packages https://t.co/p7ZSiLY5ca #javascript May 3, 2020 12:48
  • Can someone steal my IP address and use it as their own? https://t.co/HoQ7Z3BG69 January 24, 2020 13:27
  • Organizational complexity is the best predictor of bugs in a software module https://t.co/aUYn9hD4oa #softwaredevelopment January 13, 2020 08:24
  • Capitalism for people. Socialism for companies? https://t.co/zgUoPcqnix January 5, 2020 07:46
  • http://twitter.com/codingstill

Misc Links

  • George Liatsos Blog
  • Plethora Themes
  • C# / VB Converter
  • Higlabo: .NET library for mail, DropBox, Twitter & more

Connect with me

  • GitHub
  • LinkedIn
  • RSS
  • Twitter
  • Stack Overflow

Copyright © 2021 · eleven40 Pro on Genesis Framework · WordPress · Log in