a history of php

25
A History of PHP @laru ence

Upload: -

Post on 15-Jan-2017

1.935 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: A History of PHP

A History of PHP@laruence

Page 2: A History of PHP

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

Page 3: A History of PHP

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

Page 4: A History of PHP

我要讲的, 不保证都是对的!

Page 5: A History of PHP

‣ Tim Berners-Lee

‣ 欧洲原⼦核研究会(CERN)电话簿

‣ World Wide Web

‣ Web的⾸要任务就是向⼈们提供信息和信息服务

WWW(1989)

Tim Berners-Lee Web ” WorldWideWeb”

Page 6: A History of PHP

‣ FrontPage

‣ None Javascript

‣ SSI : Server Side Includes

Static Pages(1990~1993)

Page 7: A History of PHP

‣ 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/html\r\n");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 old\n",name,age);}puts("</BODY></HTML>");

}

Page 8: A History of PHP

‣ 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>

Page 9: A History of PHP

‣ PHP 2.0: PHP/FI(Form Interpreter)

‣ Written in C

‣ 还只是简单的Form解析

‣ 没有成熟的语法结构

‣ 加⼊了对mSQL的⽀持

‣ Netscape Navigator 2.0: LiveScript

‣ 1996: 50000个域名使⽤PHP

PHP 2 (1995 ~ 1997)

Page 10: A History of PHP

‣ PHP: PHP: Hypertext Preprocessor

‣ Andi, Zeev重写了Parser

‣ 终于是⼀门语⾔了(较完备的语法结构)

‣ 最关键的: 弱类型, 可扩展的语⾔

PHP 3 (1998)

Page 11: A History of PHP

‣ Zend Engine 1.0

‣ 基本的OO⽀持

‣ 会话⽀持

‣ 性能提升

‣ 社区快速发展

PHP 4 (2000)

Page 12: A History of PHP

‣ Yahoo! 从YScript迁移到了PHP

‣ Rasmus Lerdorf 也⼊职Yahoo!

PHP 4 (2002)

Page 13: A History of PHP

‣ Zend Engine 2.0

‣ 更好的OO⽀持

‣ PDO的引⼊

‣ 性能提升

‣ 社区快速成长

PHP 5 (2004)

Page 14: A History of PHP

‣ Use or Not Use Framework

Framework?(2005~2008)

Page 15: A History of PHP

‣ Unicodes⽀持

‣ 然⽽....

PHP 6 (2005)

Page 16: A History of PHP

‣ HipHop

‣ JPHP

‣ Zephir

‣ Yaf

‣ Phalcon

Performance(2010+)

Page 17: A History of PHP

‣ Secret Project by Zend

‣ Dmitry, 我

‣ Opcache + LLVM

‣ Benchmark超过了HHVM但实际项⽬中看不到提升

‣ 但是我们看到了⼀个新的⽅向

PHP5 JIT (2013)

Page 18: A History of PHP

‣ Zend Engine 3.0

‣ Dmitry, 我, 以及Nikita

‣ 基于PHP5.5 Opcache JIT项⽬

‣ 最⼤的⼀次重构, 历时⼀年多开发

‣ PHP最⼤的性能提升版本

PHP 7 (2014)

Page 19: A History of PHP

‣ 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

Page 20: A History of 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

Page 21: A History of PHP

‣ 易学习

‣ 易安装

‣ 社区庞⼤

‣ 开源系统繁多

‣ 容易找⼯作 :)

PHP的优点

Page 22: A History of PHP

‣ 1000+开发⼈员

‣ 近百万的使⽤者

‣ 上千万的域名

‣ ….

未来

Page 23: A History of PHP

PHP未来变成什么样, 完全在什么⼈加⼊这个开放的社区

Page 24: A History of 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

Page 25: A History of PHP

Q&A