Revealing a 'love history' from more than ten years ago: the relationship between PHP and Facebook

青灯夜游
Release: 2023-04-11 07:50:02
forward
2850 people have browsed it

Today I’m going to talk about a love story, about the love experience between PHP, the best programming language in the world, and Facebook.

Revealing a 'love history' from more than ten years ago: the relationship between PHP and Facebook

▲Love


PHP’s ability to fall in love with Facebook is mainly due to founder Zuckerberg.

Xiao Zha, a Harvard student, is very restless and has a lot of clever ideas. He likes to create fast-food Web projects.

The characteristics of PHP are rapid development and rapid launch. I was attracted by Xiaozha at a glance, so I abandoned Java, C#, Python, and Perl. I developed many small projects with it. Let’s take a look at just a few. :

Course Match:

On this website, people can choose the courses they want to take. You can also see other people who have chosen this course. Of course, you can also check what courses others have taken by entering their names.

Revealing a love history from more than ten years ago: the relationship between PHP and Facebook

The website is very simple, just plain text, but what surprised Xiao Zha is that many people like to click on it.

The website was deployed in his personal laptop. The website was very popular and had a huge number of visits, and soon the laptop was paralyzed.

Facemash:

This scene is described in the movie "The Social Network". Xiao Zha failed on a date and returned to the apartment to drink beer and write code.

Without permission, he invaded the servers of various Harvard colleges, "stole" photos from the address book, uploaded them to his website, displayed them in groups of two, and allowed users to judge who was hotter.

At 4 a.m., Facemash spread like a virus at Harvard University. The traffic was so heavy that the IT department had to disconnect it.

Facemash also triggered a large number of complaints. Zuckerberg was summoned by Harvard's governing board and almost expelled.

The Rome of Augustus

This is a class, but Zuckerberg is too busy programming to take it at all.

He was dumbfounded when the final exam was approaching, which required the analysis of pictures and artifacts from the reign of Augustus.

So he decided to use programming to solve the problem. He took down all the pictures from the course website and uploaded them to his own website for other students to study together. Everyone can take notes on it and view other people’s notes. .

In the end, Xiao Zha got an "excellent" in this course.

▲Marriage


These small websites fully reflect Xiao Zha’s characteristics: he has many ideas and likes to realize them quickly.

Although PHP will produce dirty code, it is not important. The key is to implement it quickly. It has become the best tool for Xiao Zha.

Through Course Match, Xiao Zha realized that people have a strong desire to understand the people around them.

Through Facemash, he learned that people like to see pictures of friends and acquaintances, and like to peek into other people's privacy.

Through "Augustus's Rome" Xiao Zha realized that people are willing to share free content.

Everything is ready, there is only one tipping point left.

At this time, the twin Winklevoss brothers appeared and asked him to make a social product called ConnectU.

Xiao Zha promised, but kept delaying, and finally launched his own social networking site: Thefacebook using PHP.

Revealing a love history from more than ten years ago: the relationship between PHP and Facebook

Thefacebook does not have any content at the beginning, and its content needs to be filled in by users.

On the website, users can upload their own pictures, write down their hobbies, elective courses, etc.

Users can have simple interactions through Poke, and more importantly, they can browse other people's content, which satisfies one's desire to "snoop".

PHP and Facebook are married.

▲Honeymoon


In "Bright Sword", Zhao Gang said: The temperament and character of an army are determined by the first military commander. This perspective is also appropriate when applied to companies.

The style Xiao Zha creates for Facebook is to break the rules, act quickly, and completion is more important than perfection.

When looking at the Facebook team, outsiders often think that they are just hackers. A group of people keep trying and iterating wildly together. This style is a perfect match for PHP.

With the help of PHP, the rapidly iterating Facebook quickly broke out of Harvard and entered all universities in the United States.

Then rush out of the United States and go to the world.

In 2012, the number of Facebook users reached an astonishing 1 billion.

It must be mentioned here that of course Facebook also wanted to enter China, but it failed. Xiao Zha also quickly changed from a "China-friendly" persona to an anti-China vanguard, openly smearing China, and trying to use geopolitics The method of "killing" the competitor TikTok is really unheard of. I will not mention it here for the time being. I will talk about it next time.

▲Breakup


Once Facebook became wealthy, it began to dislike PHP.

He often satirizes PHP as "the dynamic is exciting for a while, and the crematorium is reconstructed."

also used various pictures to humiliate the performance of PHP.

Revealing a love history from more than ten years ago: the relationship between PHP and Facebook

What to say about poor user experience, the need for more servers (which means more money needs to be spent on PHP), etc.

Also threatened to rewrite PHP!

In the face of accusations and threats, PHP laughs it off because it knows that Facebook is huge, has complex content, and has a supporting ecosystem. How is it possible to rewrite the entire system?

Facebook had no choice but to retire PHP. It could only find ways to improve PHP's execution engine Zend, but it did not get the desired performance improvement.

In 2010, Facebook learned from the pain and finally launched a big move: HipHop, which can convert PHP code into highly optimized C code, and execute it as local code after compilation.

Revealing a love history from more than ten years ago: the relationship between PHP and Facebook

After the conversion, the execution efficiency increased by as much as 6 times, which is quite an achievement.

However, it is difficult for HipHop to take a step forward in performance. It cannot fully support PHP features, such as create_function() and eval(), and it is difficult to meet Facebook's need for rapid action in terms of compilation and deployment. Require.

In 2011, Facebook simply built a PHP virtual machine HipHop VM (HHVM). HHVM can convert PHP into bytecode, and then dynamically compile it into machine code for execution at runtime. This is very similar to the JVM. Like it.

Revealing a love history from more than ten years ago: the relationship between PHP and Facebook

Coming with HHVM, there is a new love: Hack Language.

Hack is equivalent to a dialect of PHP, but it allows programmers to use both dynamic and static types.

This is a huge blow to PHP. PHP cries, makes trouble, and hangs itself, but it has no effect. After all, performance and type safety are very important for a very large system.

Facebook's system gradually adopts Hack as its new love. PHP has no choice but to leave sadly.

▲Follow-up


However, PHP’s mother-in-law family expressed dissatisfaction. They launched PHP7, which greatly improved the performance and approached Facebook’s HHVM in performance. In this case, programmers still choose PHP, after all, this is a product of the open source community.

Looking at the love history between PHP and Facebook, we noticed that PHP was very attractive to startup companies in the early 2000s because it could always develop websites quickly.

At this time, PHP can be said to be full of charm.

When the scale of the website expands and the number of users increases, the shortcomings of PHP will be exposed and it will be disliked.

Well, I just received a protest from PHP’s parents. They said that this article is not objective. Starting from PHP7, the performance has been greatly improved, and it is close to Facebook’s HHVM Hack, let alone PHP8.. ...

Well, I wish the best programming language in the world gets better and better!

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of Revealing a 'love history' from more than ten years ago: the relationship between PHP and Facebook. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:toutiao.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!