📜 ⬆️ ⬇️

If PHP were British

image

When Rasmus Lerdorf first assembled PHP, he decided, rather prudently and despite his roots, not to use Danish or even Greenlandic in it. By the way, I did it right, otherwise it would be extremely unpleasant to work with him. Instead, he, at this moment in Canada, chose a local language. No, not French, but this idiotic dialect of Royal English, which is also called "US English".

Since then, British PHP developers have expressed their displeasure towards this fact. What was he thinking about? And, most importantly, how do we fix this outrage? How can we developers ensure that the traditions of the British Empire are respected in the digital age?

On the brazen red face

$variable_name
First and foremost, and of course this is the most important change of all that will allow to achieve PHP elegance - is the removal of a character so beloved in the USA and replacing it with something more appropriate. More persistent and ... more reliable (word of lane. There is a play on words, since sterling is both pound sterling and reliable).
£variable_name

Abbreviations

Nothing is so hateful to the British as abbreviations. Communication abbreviations is unheard of for the streets of London, because not a single British grammar would agree to use abbreviations for sending even text messages, such as “See you soon, road is OK, ATP, BB!” I will arrive as soon as time allows me to do, and judging by my observations, this will happen in about an hour. I promise that the horses will ride all the way tirelessly and rest. With the deepest respect. " So, of course, write longer, but we're not in a hurry.
')
PHP, in its turn, is full of abbreviations and acronyms, which is absolutely not necessary:
str_replace()
is_int()
var_dump()
preg_match()
json_encode()
mysql_connect()
The following changes should improve the situation:
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 have burned with shame if he had learned how to twist his tongue, turning it into such deformity. Brevity is welcomed only in the right context, i.e. somewhere far away where it will not be seen, but not in our case. The if ... else block is the most commonly used code in PHP, so we must make it as harmless as possible. Options for replacing the dark-darkness, but I suggest this:
perchance (£condition) { (. )
// Code here
} otherwise { (. )
// Code here
}

Pronunciation

imagecolorallocate()
serialize()
newt_centered_window()
connection_status()
Here I just have no words. What self-respecting gentleman would expect him to understand if he says so. It is hard to believe that someone can so distort the words used in the programming language. They will be corrected for the following options, along with countless similar errors:
imagecolourallocate()
serialise()
newt_centred_window()
connexion_status()

Manners

try {
// Code here
} catch (Exception $e) {
// Handle exception
die( 'Message' );
}
A good example of the absence of any manners in PHP is the try ... catch block. Too straightforward for the new PHP. In addition to everything, the word "die" is too depressive. The new bloc is, although unduly verbose, but still more polite and optimistic:
would_you_mind { (. )
// Code here
} actually_i_do_mind (Exception £e) { (. - )
// Politely move on
cheerio( 'Message' ); (. )
}

Classes

Most likely, there is nothing more important and ingrained in the psychology of the British than classes, and, while there is still such an opportunity to correct this part of PHP, it is extremely necessary to do this:
class Republic {
public $a;
private $b;
protected $c;
}
$example = new Republic;
To begin with, the current system is not intended for a class hierarchy, and this is unacceptable. Therefore, we will begin to allocate classes to specific levels: upper, middle, working, and no class will be able to access higher-level methods without special permission from this class (and, although it will have this permission, it will not level them thus denying the right to transfer these rights to any other lower classes). “Public” and “Private” in the British class system are most often synonymous (see, for example, the nomenclature of school education), because they must be changed, as well as “Protected”. The word "new" (the lane is new), although it is valid, must still be replaced by a more appropriate one for class questions:
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 change the reputation and status of PHP among other languages. He will no longer be considered a poor American cousin; instead, he will be able to take his rightful place as a British language - the King of scripting languages.

Source: https://habr.com/ru/post/126737/


All Articles