If PHP is written in British English

Source: Internet
Author: User
If PHP is written in British English
PHP's father, Rasmus Lerdorf, when he created PHP, was not written in either Greenland or Danish (though he had Greenland and Danish descent), which was very sensible. Although it was written in English for him, it was not easy to write in his native language. As he had been in Canada before, he chose the local dialect. It is not French, nor is it a dialect that is not in the pure English standard, we often call it "American English".

Since then, British PHP developers have been particularly dissatisfied with the issue. What is Rasmus thinking? More importantly, how do we change this fact? How can our developers ensure that even in the digital age, the fine traditions of the Daying Empire continue to flourish?

A slap in the face

$variable _name The most necessary change is to remove some of the symbols that are well-liked by Americans and replace them with some more refined symbols to make PHP more elegant.

£variable_name, let's go.

How many of today's British programmers have come into contact with the typical American program of "Hello World", albeit simple but trite and disgusting? A more formal presentation would promote the use of the language by most young British geniuses, thus providing a more refined atmosphere for the wider user base.

Abbreviated words

Nothing is more hateful to the English than the unnecessary abbreviations. "Abbreviations" are unheard of in the streets of London, as native British grammars refuse to send a "C u soon traffic Kthxbye" message, preferring to use some seemingly more refined words instead: "Dear sir or Madam." As long as the time allows, I hope to arrive within one hours as soon as possible. I assure you that your horses will be properly placed. to the King. (The input is slow, yes, but not hasty).

On the other hand, PHP contains a lot of needless acronyms and acronyms.

Str_replace () Is_int () Var_dump () Preg_match () Json_encode () mysql_connect () should be changed to the following:

String_replace () Is_integer () Variable_dump () Perl_regular_expression_match () Javascript_object_notation_encode () My_structured_query_language_connect () Correction: I have corrected the extension of "preg_match"-thanks to the friends who have pointed out.

Eloquence

if ($condition) {//code here} else {//code here} Shakespeare would not like to see his native language distorted into this monster. Brevity is popular in the right places-not necessarily in some remote areas-but not here. The "If ... else" module is the most used condition code in PHP, so it must be as safe to use as possible. There are many options to replace, but this conditional statement may be the most robust.

Perchance (£condition) {//code here} otherwise {//code here} The above modules also apply to the United States, can only be said to be cumbersome, disgusting switch ... case concept,

Switch ($variable) {case $option 1://code, Case $option 2://code here, default://code here break;} like "s Witch "," Break "and" default "are very difficult and lack of contact for the reader. This American usage really needs to be improved. (People who use American usage have some interesting ideas and expect to use I_MIGHT_BE_PARTIAL_TO () instead of include () to show their genius programming talent):

What_about (£variable) {perhaps£possibility://code here Splendid, perhaps£other_possibility://code here Splendid; on_ The_off_chance://code here Splendid; } spelling

Imagecolorallocate () serialize () Newt_centered_window () Connection_status () at this point, the words let me eat a lot of losses. The self-respecting gentleman looked forward to understanding the words. It weakens the belief that anyone accepts the distorted meaning of words in a programming language. These "words" and many similar errors should be returned to the appropriate form immediately.

Imagecolourallocate () serialise () Newt_centred_window () Connexion_status () habit

try {//Code here} catch (Exception $e) {//Handle Exception die (' Message ');} Try ... catch statement block is a good proof of the lack of PHP features. The new PHP is too straightforward to allow the use of the module http://www.gw005.com, without the necessary limitations. In addition, the word "die" is frustrating. This new module, though more verbose, is more elegant and optimistic.

Would_you_mind {//Code here} actually_i_do_mind (exception£e) {//politely move on Cheerio (' Message ');} class

In the English mind, nothing is as important and ingrained as the concept of the class, and this part of PHP rarely changes unless it is a significant change made here.

Class Republic {public $a; private $b; protected $c;} $example = new Republic; First, there is no room for class hierarchies in the popular system, which is unacceptable. So we should first give the class A certain level-upper, middle, working layer (upper, middle, working)-if there is no explicit permission for the higher-level instruction class, the class will not be able to use a more advanced class method (of course, even though it has later visited more advanced classes, However, it is not a full member of the more advanced directives and cannot be granted more advanced instructions for accessing other low-level instruction classes. "Public" and "private" are synonyms in the English class system (for example, the school system is named), so these must be adjusted, and the attribute visibility of "protected" is the same. The word "new", although feasible, requires a more appropriate word to be substituted for the class problem.

Upper_class Empire {state£a; private£b; hereditary£c;}£example = Nouveau Empire; The day does not fall ...

Hopefully these few simple changes will improve PHP's reputation and position in many programming languages. It is no longer a distant cousin of a lame American. Instead, it can return to the embrace of the British, the King of scripting languages.

Note: The original author Dave is a British developer.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.