A History of PHP
@laruence
SELF INTRODUCTION
‣ Author of Yaf, Yar, Yac, Yaconf, Taint Projects
‣ Maintainer of Opcache, Msgpack, PHP-Lua Projects
‣ PHP Core Developer Since 2011
‣ Zend Consultant Since 2013
‣ One of PHP7 Core Developers: Dmitry Stogov, Xinchen Hui, Nikita Popov
‣ Chief Software Architect at Lianjia Since 2015
W3Techs.com 100
‣ Created in 1994 by Rasmus Lerdorf
‣ 20+ Years Programming Language
‣ Most Popular Web Service Program Language
‣ PHP7 is Released at 3 Dec 2015
‣ Latest Version is PHP7.0.4
PHP
我要讲的, 不保证都是对的!
‣ Tim Berners-Lee
‣ 欧洲原⼦核研究会(CERN)电话簿
‣ World Wide Web
‣ Web的⾸要任务就是向⼈们提供

信息和信息服务
WWW(1989)
Tim Berners-Lee Web ” WorldWideWeb”
‣ FrontPage
‣ None Javascript
‣ SSI : Server Side Includes
Static Pages(1990~1993)
‣ CGI (Comm Getway Interface)
‣ CGI 1.0定义了程序和WebServer通信的接⼜
‣ CGI ⼤部分使⽤C, Pascal等传统语⾔编写
‣ 开发维护执⾏效率都很低
‣ 曾经URL中随处可见的cgi-bin
CGI(1993)
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#define ishex(x) (((x) >= '0' && (x) <= '9') || ((x) >= 'a' && 
(x) <= 'f') || ((x) >= 'A' && (x) <= 'F'))
int htoi(char *s) {
int value;
char c;
c = s[0];
if(isupper(c)) c = tolower(c);
value=(c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10) * 16;
c = s[1];
if(isupper(c)) c = tolower(c);
value += c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10;
return(value);
}
void main(int argc, char *argv[]) {
char *params, *data, *dest, *s, *tmp;
char *name, *age;
puts("Content-type: text/htmlrn");
puts("<HTML><HEAD><TITLE>Form Example</TITLE></HEAD>");
puts("<BODY><H1>My Example Form</H1>");
puts("<FORM action="form.cgi" method="GET">");
puts("Name: <INPUT type="text" name="name">");
puts("Age: <INPUT type="text" name="age">");
puts("<BR><INPUT type="submit">");
puts("</FORM>");
data = getenv("QUERY_STRING");
if(data && *data) {
params = data; dest = data;
while(*data) {
if(*data=='+') *dest=' ';
else if(*data == '%' && ishex(*(data+1))&&ishex(*(data+2))) {
*dest = (char) htoi(data + 1);
data+=2;
} else *dest = *data;
data++;
dest++;
}
*dest = '0';
s = strtok(params,"&");
do {
tmp = strchr(s,'=');
if(tmp) {
*tmp = '0';
if(!strcmp(s,"name")) name = tmp+1;
else if(!strcmp(s,"age")) age = tmp+1;
}
} while(s=strtok(NULL,"&"));
printf("Hi %s, you are %s years oldn",name,age);
}
puts("</BODY></HTML>");
}
‣ PHP 1.0: Personal HomePage Tool
‣ Written in Perl
‣ Solves Problems
‣ ⾸创: HTML和脚本融合在⼀起
‣ 开发维护效率⼤幅提升
PHP 1 (1994)
<html><head><title>Form Example</title></head>
<body><h1>My Example Form</h1>
<form action="form.phtml" method="POST">
Name: <input type="text" name="name">
Age: <input type="text" name="age">
<br><input type="submit">
</form>
<?if($name):?>
Hi <?echo $name?>, you are <?echo $age?> years old
<?endif?>
</body></html>
‣ PHP 2.0: PHP/FI(Form Interpreter)
‣ Written in C
‣ 还只是简单的Form解析
‣ 没有成熟的语法结构
‣ 加⼊了对mSQL的⽀持
‣ Netscape Navigator 2.0: LiveScript
‣ 1996: 50000个域名使⽤PHP
PHP 2 (1995 ~ 1997)
‣ PHP: PHP: Hypertext Preprocessor
‣ Andi, Zeev重写了Parser
‣ 终于是⼀门语⾔了(较完备的语法结构)
‣ 最关键的: 弱类型, 可扩展的语⾔
PHP 3 (1998)
‣ Zend Engine 1.0
‣ 基本的OO⽀持
‣ 会话⽀持
‣ 性能提升
‣ 社区快速发展
PHP 4 (2000)
‣ Yahoo! 从YScript迁移到了PHP
‣ Rasmus Lerdorf 也⼊职Yahoo!
PHP 4 (2002)
‣ Zend Engine 2.0
‣ 更好的OO⽀持
‣ PDO的引⼊
‣ 性能提升
‣ 社区快速成长
PHP 5 (2004)
‣ Use or Not Use Framework
Framework?(2005~2008)
‣ Unicodes⽀持
‣ 然⽽....
PHP 6 (2005)
‣ HipHop
‣ JPHP
‣ Zephir
‣ Yaf
‣ Phalcon
Performance(2010+)
‣ Secret Project by Zend
‣ Dmitry, 我
‣ Opcache + LLVM
‣ Benchmark超过了HHVM但实际项⽬中看不到提升
‣ 但是我们看到了⼀个新的⽅向
PHP5 JIT (2013)
‣ Zend Engine 3.0
‣ Dmitry, 我, 以及Nikita
‣ 基于PHP5.5 Opcache JIT项⽬
‣ 最⼤的⼀次重构, 历时⼀年多开发
‣ PHP最⼤的性能提升版本
PHP 7 (2014)
‣ http://phpsadness.com/
‣ http://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/
‣ http://blog.codinghorror.com/the-php-singularity/
‣ http://webonastick.com/php.html
‣ http://aurelio.audero.it/blog/2014/02/05/why-people-think-php-sucks/
‣ https://maurus.net/resources/programming-languages/php/
‣ http://www.bitstorm.org/edwin/en/php/
‣ https://teamtreehouse.com/forum/why-php-sucks
‣ https://www.reddit.com/r/PHP/.../why_do_so_many_developers_hate_php/
‣ https://www.quora.com/.../Is-PHP-a-badly-designed-programming-language/
‣ 还有很多…
有些⼈不喜欢PHP
‣ Haters Gonna Hate
‣ They Are True
‣ History is History
‣ Use The Right Tool
‣ If you like it, Ignore the hate, Get things done
语⾔只是⼯具
Shake if off - Taylor swift
‣ 易学习
‣ 易安装
‣ 社区庞⼤
‣ 开源系统繁多
‣ 容易找⼯作 :)
PHP的优点
‣ 1000+开发⼈员
‣ 近百万的使⽤者
‣ 上千万的域名
‣ ….
未来
PHP未来变成什么样, 完全在什么⼈
加⼊这个开放的社区
‣ http://w3techs.com/technologies/overview/programming_language/all
‣ https://zh.wikipedia.org/wiki/Tim_Berners-Lee
‣ http://talks.php.net/confoo16#/2
‣ http://www.slideshare.net/isotopp/20-years-of-php
‣ http://php.net/manual/en/history.php.php
Links
Q&A

A History of PHP

  • 1.
    A History ofPHP @laruence
  • 2.
    SELF INTRODUCTION ‣ Authorof Yaf, Yar, Yac, Yaconf, Taint Projects ‣ Maintainer of Opcache, Msgpack, PHP-Lua Projects ‣ PHP Core Developer Since 2011 ‣ Zend Consultant Since 2013 ‣ One of PHP7 Core Developers: Dmitry Stogov, Xinchen Hui, Nikita Popov ‣ Chief Software Architect at Lianjia Since 2015
  • 3.
    W3Techs.com 100 ‣ Createdin 1994 by Rasmus Lerdorf ‣ 20+ Years Programming Language ‣ Most Popular Web Service Program Language ‣ PHP7 is Released at 3 Dec 2015 ‣ Latest Version is PHP7.0.4 PHP
  • 4.
  • 5.
    ‣ Tim Berners-Lee ‣欧洲原⼦核研究会(CERN)电话簿 ‣ World Wide Web ‣ Web的⾸要任务就是向⼈们提供
 信息和信息服务 WWW(1989) Tim Berners-Lee Web ” WorldWideWeb”
  • 6.
    ‣ FrontPage ‣ NoneJavascript ‣ SSI : Server Side Includes Static Pages(1990~1993)
  • 7.
    ‣ CGI (CommGetway Interface) ‣ CGI 1.0定义了程序和WebServer通信的接⼜ ‣ CGI ⼤部分使⽤C, Pascal等传统语⾔编写 ‣ 开发维护执⾏效率都很低 ‣ 曾经URL中随处可见的cgi-bin CGI(1993) #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> #define ishex(x) (((x) >= '0' && (x) <= '9') || ((x) >= 'a' && (x) <= 'f') || ((x) >= 'A' && (x) <= 'F')) int htoi(char *s) { int value; char c; c = s[0]; if(isupper(c)) c = tolower(c); value=(c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10) * 16; c = s[1]; if(isupper(c)) c = tolower(c); value += c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10; return(value); } void main(int argc, char *argv[]) { char *params, *data, *dest, *s, *tmp; char *name, *age; puts("Content-type: text/htmlrn"); puts("<HTML><HEAD><TITLE>Form Example</TITLE></HEAD>"); puts("<BODY><H1>My Example Form</H1>"); puts("<FORM action="form.cgi" method="GET">"); puts("Name: <INPUT type="text" name="name">"); puts("Age: <INPUT type="text" name="age">"); puts("<BR><INPUT type="submit">"); puts("</FORM>"); data = getenv("QUERY_STRING"); if(data && *data) { params = data; dest = data; while(*data) { if(*data=='+') *dest=' '; else if(*data == '%' && ishex(*(data+1))&&ishex(*(data+2))) { *dest = (char) htoi(data + 1); data+=2; } else *dest = *data; data++; dest++; } *dest = '0'; s = strtok(params,"&"); do { tmp = strchr(s,'='); if(tmp) { *tmp = '0'; if(!strcmp(s,"name")) name = tmp+1; else if(!strcmp(s,"age")) age = tmp+1; } } while(s=strtok(NULL,"&")); printf("Hi %s, you are %s years oldn",name,age); } puts("</BODY></HTML>"); }
  • 8.
    ‣ PHP 1.0:Personal HomePage Tool ‣ Written in Perl ‣ Solves Problems ‣ ⾸创: HTML和脚本融合在⼀起 ‣ 开发维护效率⼤幅提升 PHP 1 (1994) <html><head><title>Form Example</title></head> <body><h1>My Example Form</h1> <form action="form.phtml" method="POST"> Name: <input type="text" name="name"> Age: <input type="text" name="age"> <br><input type="submit"> </form> <?if($name):?> Hi <?echo $name?>, you are <?echo $age?> years old <?endif?> </body></html>
  • 9.
    ‣ PHP 2.0:PHP/FI(Form Interpreter) ‣ Written in C ‣ 还只是简单的Form解析 ‣ 没有成熟的语法结构 ‣ 加⼊了对mSQL的⽀持 ‣ Netscape Navigator 2.0: LiveScript ‣ 1996: 50000个域名使⽤PHP PHP 2 (1995 ~ 1997)
  • 10.
    ‣ PHP: PHP:Hypertext Preprocessor ‣ Andi, Zeev重写了Parser ‣ 终于是⼀门语⾔了(较完备的语法结构) ‣ 最关键的: 弱类型, 可扩展的语⾔ PHP 3 (1998)
  • 11.
    ‣ Zend Engine1.0 ‣ 基本的OO⽀持 ‣ 会话⽀持 ‣ 性能提升 ‣ 社区快速发展 PHP 4 (2000)
  • 12.
    ‣ Yahoo! 从YScript迁移到了PHP ‣Rasmus Lerdorf 也⼊职Yahoo! PHP 4 (2002)
  • 13.
    ‣ Zend Engine2.0 ‣ 更好的OO⽀持 ‣ PDO的引⼊ ‣ 性能提升 ‣ 社区快速成长 PHP 5 (2004)
  • 14.
    ‣ Use orNot Use Framework Framework?(2005~2008)
  • 15.
  • 16.
    ‣ HipHop ‣ JPHP ‣Zephir ‣ Yaf ‣ Phalcon Performance(2010+)
  • 17.
    ‣ Secret Projectby Zend ‣ Dmitry, 我 ‣ Opcache + LLVM ‣ Benchmark超过了HHVM但实际项⽬中看不到提升 ‣ 但是我们看到了⼀个新的⽅向 PHP5 JIT (2013)
  • 18.
    ‣ Zend Engine3.0 ‣ Dmitry, 我, 以及Nikita ‣ 基于PHP5.5 Opcache JIT项⽬ ‣ 最⼤的⼀次重构, 历时⼀年多开发 ‣ PHP最⼤的性能提升版本 PHP 7 (2014)
  • 19.
    ‣ http://phpsadness.com/ ‣ http://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ ‣http://blog.codinghorror.com/the-php-singularity/ ‣ http://webonastick.com/php.html ‣ http://aurelio.audero.it/blog/2014/02/05/why-people-think-php-sucks/ ‣ https://maurus.net/resources/programming-languages/php/ ‣ http://www.bitstorm.org/edwin/en/php/ ‣ https://teamtreehouse.com/forum/why-php-sucks ‣ https://www.reddit.com/r/PHP/.../why_do_so_many_developers_hate_php/ ‣ https://www.quora.com/.../Is-PHP-a-badly-designed-programming-language/ ‣ 还有很多… 有些⼈不喜欢PHP
  • 20.
    ‣ Haters GonnaHate ‣ They Are True ‣ History is History ‣ Use The Right Tool ‣ If you like it, Ignore the hate, Get things done 语⾔只是⼯具 Shake if off - Taylor swift
  • 21.
    ‣ 易学习 ‣ 易安装 ‣社区庞⼤ ‣ 开源系统繁多 ‣ 容易找⼯作 :) PHP的优点
  • 22.
    ‣ 1000+开发⼈员 ‣ 近百万的使⽤者 ‣上千万的域名 ‣ …. 未来
  • 23.
  • 24.
    ‣ http://w3techs.com/technologies/overview/programming_language/all ‣ https://zh.wikipedia.org/wiki/Tim_Berners-Lee ‣http://talks.php.net/confoo16#/2 ‣ http://www.slideshare.net/isotopp/20-years-of-php ‣ http://php.net/manual/en/history.php.php Links
  • 25.