


Revealing a 'love history' from more than ten years ago: the relationship between PHP and Facebook
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.
▲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.
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.
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.
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.
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.
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.
