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
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.
Let's go
- Php
- Echo ' Hello world! ';
- ?>
How many of today's British programmers are initially exposed to the "Hello world", a typical American program, albeit simple but trite and disgusting? A more formal presentation would promote the use of the language by most young British geniuses, This provides a more refined atmosphere for the wider user base.
- Php
- Announce ' good Morrow, fellow subjects of the Crown.
- ?>
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 ()
It should be changed to the following:
- String_replace ()
- Is_integer ()
- Variable_dump ()
- Perl_regular_expression_match ()
- Javascript_object_notation_encode ()
Correction: I have corrected the extension of "preg_match"--thanks to the friends who are pointing out.
Eloquence
- if ($condition) {
-
- Else {
-
Shakespeare did not want to see his mother tongue twisted 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) {
-
- } otherwise {
-
The above modules also apply to the United States, can only be said to be cumbersome, people hate switch ... case concept,
- Switch ($variable) {
- Case $option 1:
- //code here
- Break ;
- Case $option 2:
- //code here
- Break ;
- default :
- //code here
- Break ;
- }
Keywords such as "switch", "Break" and "default" are 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:
-
- Splendid
- Perhaps£other_possibility:
-
- Splendid
- On_the_off_chance:
-
- Splendid
Spelling
- Imagecolorallocate ()
- Serialize ()
- Newt_centered_window ()
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 ()
Habit
- try {
-
- $e ) {
-
- die (' Message ');
The try ... catch statement block is a good proof of the lack of PHP features. The new PHP is too straightforward to allow the module to be used, and lacks the necessary limitations. In addition, the word "die" is frustrating. This new module, though more verbose, is more elegant and optimistic.
- Would_you_mind {
-
- } actually_i_do_mind (Exception£e) {
-
- 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 span>;
- }
- $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 (upper, middle, working)-the class cannot use a more advanced class method without explicit permission from the higher class directive (although, of course, even though it has later visited a more advanced class, 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;
- }
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.
English Original:
http://www.bkjia.com/PHPjc/445711.html www.bkjia.com true http://www.bkjia.com/PHPjc/445711.html techarticle 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 for him to use English ...