php-manual-ja

3658
file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html 1 / 3658 07.12.11 0:51 AM PHP マニュアル Mehdi Achour Friedhelm Betz Antony Dovgal Nuno Lopes Hannes Magnusson Georg Richter Damien Seguy Jakub Vrana その他 2007/12/11 Philip Olson PHP マニュアル翻訳プロジェクト © 1997-2007 the PHP Documentation Group 著作権 Copyright © 1997 - 2007 by the PHP Documentation Group. この著作物は、Open Publication License, v1.0 か それ以降で指定された条件と制 約に従う限り配布することができます。 Open Publication License のコピーは本マニュアルとともに配布されており、 ライセンスの最新版は現在の ところ、 » http://www.opencontent.org/openpub/ で入手可能です。 この文書を実質的に変更した場合、 その配布を著作権保有者の明確な許可なしに行うことを禁止します。 この著作物かその派生物の一般的な(紙媒体の)書籍形式での配布は、 著作権所有者から前もって許可を得ない限り禁止します。 修正の有無に関わらず本文書の全体または一部を再配布または再出版したい場合や、 質問がある場合には、 » [email protected] 宛で著作権 者まで連絡をしてください。 このアドレスは、一般にアーカイブが公開されているメーリングリストへマップされていることに 注意して下さい。 このマニュアルのセクション Zend Engine 1 は、 Zend Technologies より提供された文書を基にしています。 (訳注)本日本語訳の記述内容により生じたいかなる損害についても 著作権所有者および翻訳者は責任を負いません。 序文 PHP は、"PHP: Hypertext Preprocessor" を意味し、広く使用されているオープンソースの汎用スクリプト言語です。 HTML に埋め込むことがで き、Web アプリケーションの開発に特に適しています。 PHP の構文の多くは C、Java、Perl 言語から転用したもので、 簡単に習得することができま す。この言語は、動的に生成されるウェブページを Web 開発者が速やかに作成できるようにすることを主な目標として つくられました。しかし、それ だけにとどまらず、 もっと多くのことを PHP を使って行うことができます。 このマニュアルは、 関数リファレンス を中心として、言語リファレンス 、 PHP の主な機能 、 そして、その他の 付録 から構成されています。 本マニュアルを様々な形式で » http://www.php.net/download-docs.php からダウンロードすることが出来ます。 このマニュアルがどのように作成 されているか、といった詳細な情報は 付録の 本マニュアルについて にあります。 PHP の歴史 に興味がある場合は、 関連する付録も参照して下さい。 著者と貢献者 我々は、現在最も活動的な人々をこのマニュアルの先頭に掲げています。しかし、他にも多くの我々の活動を支援してくれる人がおり、また、過去にこ のプロジェクトを支援してくれた人がいます。マニュアルのユーザ注記により支援してくれた名前がわからない人々がいますが、彼らの支援は非常に有 益です。以下に掲げたリストはアルファベット順です。 著者と編集者 以下の方々は本マニュアルについてコンテンツを提供したことで大きな貢献をしています。 Bill Abt, Jouni Ahto, Alexander Aulbach, Daniel Beckham, Stig Bakken, Jesus M. Castagnetto, Ron Chmara, Sean Coates, John Coggeshall, Simone Cortesi, Markus Fischer, Wez Furlong, Sara Golemon, Rui Hirokawa, Brad House, Pierre-Alain Joye, Etienne Kneuss, Moriyoshi Koizumi, Rasmus Lerdorf, Andrew Lindeman, Stanislav Malyshev, Rafael Martinez, Rick McGuire, Yasuo Ohgaki, Derick Rethans, Rob Richards, Sander Roobol, Egon Schmid, Thomas Schoefbeck, Sascha Schumann, Dan Scott, Masahiro Takagi, Michael Wallner, Lars Torben Wilson, Jim Winstead, Jeroen van Wolffelaar そ して Andrei Zmievski. 以下の方々は本マニュアルについて多くの編集作業を行ったことで大きな貢献をしています。 Stig Bakken, Gabor Hojtsy, Hartmut Holzgraefe そし

Transcript of php-manual-ja

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

PHP Mehdi Achour Friedhelm Betz Antony Dovgal Nuno Lopes Hannes Magnusson Georg Richter Damien Seguy Jakub Vrana 2007/12/11 Philip Olson PHP 1997-2007 the PHP Documentation Group

Copyright 1997 - 2007 by the PHP Documentation Group. Open Publication License, v1.0 Open Publication License http://www.opencontent.org/openpub/ () [email protected] Zend Engine 1 Zend Technologies ()

PHP "PHP: Hypertext Preprocessor" HTML Web PHP CJavaPerl Web PHP PHP http://www.php.net/download-docs.php PHP

Bill Abt, Jouni Ahto, Alexander Aulbach, Daniel Beckham, Stig Bakken, Jesus M. Castagnetto, Ron Chmara, Sean Coates, John Coggeshall, Simone Cortesi, Markus Fischer, Wez Furlong, Sara Golemon, Rui Hirokawa, Brad House, Pierre-Alain Joye, Etienne Kneuss, Moriyoshi Koizumi, Rasmus Lerdorf, Andrew Lindeman, Stanislav Malyshev, Rafael Martinez, Rick McGuire, Yasuo Ohgaki, Derick Rethans, Rob Richards, Sander Roobol, Egon Schmid, Thomas Schoefbeck, Sascha Schumann, Dan Scott, Masahiro Takagi, Michael Wallner, Lars Torben Wilson, Jim Winstead, Jeroen van Wolffelaar Andrei Zmievski. Stig Bakken, Gabor Hojtsy, Hartmut Holzgraefe

1 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

Egon Schmid.

Mehdi Achour, Etienne Kneuss, Nuno Lopes, Hannes Magnusson, Bobby Matthis Maciek Sokolewicz. Daniel Beckham, Friedhelm Betz, Victor Boivie, Jesus M. Castagnetto, Nicolas Chaillan, Ron Chmara, Sean Coates, James Cox, Vincent Gevers, Sara Golemon, Zak Greant, Szabolcs Heilig, Oliver Hinckel, Hartmut Holzgraefe, Rasmus Lerdorf, Matthew Li, Andrew Lindeman, Aidan Lister, Maxim Maletsky, James Moore, Philip Olson, Sebastian Picklum, Derick Rethans, Sander Roobol, Damien Seguy, Jason Sheets, Tom Sommer, Jani Taskinen, Yasuo Ohgaki, Jakub Vrana, Lars Torben Wilson, Jim Winstead, Jared Wyles Jeroen van Wolffelaar.

PHP Chihiro Higuchi, Haruki Setoyama, Hideyuki Shimooka, Kazuhiko Ogura, Machino Satoshi, Masaharu Iwai, Masahiro Takagi, Masaki Fujimoto, Michihide Hotta, Moriyoshi Koizumi, Rui Hirokawa, Shigeru Kanemoto, Tadashi Jokagi, Yasuo Ohgaki, Yu Watanabe, Yusuke Hata.

PHP?

PHP ?PHP ("PHP: Hypertext Preprocessor" ) PHP Web HTML ? Example#1

Example

"/hello.php" Web URL URL http://localhost/hello.php http://127.0.0.1/hello.php Web PHP

PHP Test Hello World

PHP Hello World PHP echo() ".php" PHP PHP HTML PHP PHP PHP PHP PHP PHP HTML : HTML HTML ?> PHP PHP include ?> PHP echo/print : PHP (IDE) PHP : StarOffice Writer, Microsoft Word Abiword PHP PHP : Windows Windows PHP .php ( .txt ) ("hello.php" ) """" PHP PHP ! phpinfo() PHP Example#2 PHP Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

PHP

$_SERVER PHP phpinfo() PHP PHP echo Example#2 Internet Explorer

if C C PHP strpos() strpos() PHP

$_SERVER['HTTP_USER_AGENT'] ( haystack) "MSIE" (needle) FALSE FALSE if TRUE {} if, else strtoupper() strlen() PHP PHP PHP Example#3 HTML PHP strposfalse Internet Explorer strposfalse Internet Explorer strposfalse Internet Explorer

PHP echo PHP HTML strpos() TRUE FALSE MSIE HTML

PHP HTML PHP PHP PHP HTML

6 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

Example#1 HTML : : HTML action.php Example#2 Joe 22

htmlspecialchars() (int) htmlspecialchars() html HTML Javascript age integer PHP filter $_POST['name'] $_POST['age'] PHP

$_SERVER POST $_POST POST GET $_GET $_REQUEST GET, POST, COOKIE, FILE import_request_variables() XForms PHP HTML XForms XForm

PHP PHP PHP () PHP

$HTTP_*_VARS ( ) 4.1.0 $_GET, $_POST, $_COOKIE,

$_SERVER, $_ENV, $_REQUEST, $_SESSION. $HTTP_POST_VARS $HTTP_*_VARS PHP 3 PHP 5.0.0 PHP register_long_arrays PHP 4.2.0 PHP register_globals php.ini off on URL http://www.example.com/foo.php?id=42 $id onoff

$_GET['id']

? Web php.net http://www.php.net/links.php PHP PHP http://conf.php.net/ http://talks.php.net/

7 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

Unix Mac OS X Windows PECL

PHP PHP PHP 3 Web Web () (GUI) PHP Web Web 3 Web Web Linux Apache Windows IIS Web PHP Web PHP PHP 2 (SAPI ) PHP ApacheMicrosoft Internet Information Server NetscapeiPlanet ISAPI Web OmniHTTPd PHP Web CGI FastCGI PHP PHP PHP Web PHP PHP PHP-GTK PHP GUI Web HTML PHP-GTK PHP-GTK PHP-GTK PHP Unix Windows Web CGI PHP PHP Windows http://www.php.net/

Unix Apache 2.0 (Unix) Caudium fhttpd Sun, iPlanet, Netscape Sun Solaris CGI HP-UX OpenBSD Solaris Debian GNU/Linux UNIX PHP Web

8 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

Web PHP Unix PHP Unix PHP Web UNIX ("make" C ) ANSI C flex: 2.5.4 bison: 1.28 (), 1.35, 1.75 Web (gdpdf ) PHP configure ./configure --help PHP PHP configure make configure

Apache 1.3.x (Unix )PHP Unix Apache 1.3.x Apache 2 'xxx' 10 configure configure Example#1 PHP (Apache ) 1.

2.

3.

4.

5.

6.

7.

8.

9.

gunzip apache_xxx.tar.gz tar -xvf apache_xxx.tar gunzip php-xxx.tar.gz tar -xvf php-xxx.tar cd apache_xxx ./configure --prefix=/www --enable-module=so make make install cd ../php-xxx

10. PHP configure

./configure --help

Apache 1 MySQL

apxs Apache

./configure --with-mysql --with-apxs=/www/bin/apxs

11. make 12. make install

configure 3

PHP

Apache Apache

'make install' PEAR, phpize

CLIPHP 13. php.ini

cp php.ini-dist /usr/local/lib/php.ini

PHP .ini

10

--with-config-file-path=/path

php.ini-dist php.ini-recommended PHP

14. httpd.conf PHP

LoadModule PHP

make install

PHP 4 :

LoadModule php4_module libexec/libphp4.so

9 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

PHP 5 :

LoadModule php5_module libexec/libphp5.so

15. httpd.conf AddModule

ClearModuleList

PHP 4 :

AddModule mod_php4.c

PHP 5 :

AddModule mod_php5.c

16. Apache PHP httpd.conf

Apache .php PHP

PHP .php .phtml

AddType application/x-httpd-php .php .phtml

PHP .phps

AddType application/x-httpd-php-source .phps

17. Apache HUP USR1

PHP Example#2 PHP (Apache ) 1.

2.

3.

4.

5.

6.

7.

8.

9.

gunzip -c apache_1.3.x.tar.gz | tar xf cd apache_1.3.x ./configure cd .. gunzip -c php-5.x.y.tar.gz | tar xf cd php-5.x.y ./configure --with-mysql --with-apache=../apache_1.3.x make make install

10. cd ../apache_1.3.x 11. ./configure --prefix=/www --activate-module=src/modules/php5/libphp5.a

( libphp5.a

) 12. make

(httpd Apache

"make install" ) 13. cd ../php-5.x.y 14. cp php.ini-dist /usr/local/lib/php.ini 15. /usr/local/lib/php.ini PHP

httpd.conf srm.conf

AddType application/x-httpd-php .php

: PHP 4 php-5 php-4 php5 php4 Apache UNIX Apache/UNIX /path/to/ Example#3 Apache 1. Linux System V /etc/rc.d/init.d/httpd restart 2. apachectl /path/to/apachectl stop /path/to/apachectl start 3. (OpenSSL ) httpdctl httpsdctl /path/to/httpsdctl stop /path/to/httpsdctl start 4. mod_ssl SSL stop start /path/to/apachectl stop /path/to/apachectl startssl

10 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

apachectl http(s)dctl locate whereiswhich PHP Apache ./configure --with-apxs --with-pgsql Apache libphp5.so ( PHP 4 libphp4.so) Apache httpd.conf LoadModule PostgreSQL ./configure --with-apxs --with-pgsql=shared Apache libphp4.so PHP pgsql.so PHP php.ini extension PHP dl() ./configure --with-apache=/path/to/apache_source --with-pgsql libmodphp5.a mod_php5.c Apache

src/modules/php5 --activate-module=src/modules/php5/libphp5.a Apache Apache libphp5.a httpd (PHP 4 php5 php4 )PostgreSQL httpd Apache PHP httpd ./configure --with-apache=/path/to/apache_source --with-pgsql=shared httpd PostgreSQL pgsql.so PHP php.ini dl() PHP PHP Apache PHP PHP Apache PHP Apache Web (DSO) : Apache httpd.conf User nobody Group "#-1" "Group nogroup" "Group daemon" PHP : --with-apxs=/path/to/apxs apxs Apache apxs

Apache 2.0 (Unix)PHP Unix Apache 2.0 Apache2 MPM prefork MPM Apache1 MPM Apache2 FAQ Apache Apache 2.0.x : PHP Apache 2.0.x PHP Apache 2.0.x PHP 4.3.0 ( http://www.php.net/downloads.php ) http://snaps.php.net/php5-latest.tar.gz Windows http://snaps.php.net/win32/php5-win32-latest.zip http://qa.php.net/ anonymous CVS PHP PHPApache 2.0.40 Apache 2.0 SAPI PHP 4.2.0 PHP 4.2.3 Apache 2.0.39 PHP 4.2.3 Apache PHP 4.3.0 PHP Apache2 PHP Apache 1.3.x Apache 2.0 PHP Apache 2.0 PHP Apache

11 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

'NN' Example#1 (Apache 2 ) 1.

2.

3.

4.

5.

6.

7.

8.

gzip -d httpd-2_0_NN.tar.gz tar xvf httpd-2_0_NN.tar gunzip php-NN.tar.gz tar -xvf php-NN.tar cd httpd-2_0_NN ./configure --enable-so make make install

Apache 2.0.NN

MPM prefork

/usr/local/apache2

/usr/local/apache2/bin/apachectl start

/usr/local/apache2/bin/apachectl stop

PHP 9.

cd ../php-NN 10. PHP configure

./configure --help

Apache 2 MySQL

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql 11. make 12. make install

configure 3

PHP

Apache Apache

'make install' PEARphpize

CLIPHP

13. php.ini

cp php.ini-dist /usr/local/lib/php.ini

PHP .ini

10

--with-config-file-path=/path

php.ini-dist php.ini-recommended PHP

14. httpd.conf PHP

LoadModule PHP

make install

PHP 4 :

LoadModule php4_module modules/libphp4.so

PHP 5 :

LoadModule php5_module modules/libphp5.so

15. Apache PHP httpd.conf

Apache .php PHP

PHP .php .phtml

AddType application/x-httpd-php .php .phtml

PHP .phps

AddType application/x-httpd-php-source .phps

16. Apache

/usr/local/apache2/bin/apachectl start

SAPI PHP Apache 2.0 Apache PHP configure ./configure --help Apache 2.0 MPM prefork worker perchild 6 --with-mpm=worker --with-mpm=perchild Apache (MPM)

12 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

: Apache MultiViews FAQ : Apache PHP Zend Thread Safety (ZTS)

prefork MPM

Caudium PHP 4 Caudium Web Pike PHP 3 PHP 4 Caudium Example#1 Caudium 1.

PHP 4 Caudium

PHP 4 Pike 7.0.268

Caudium /opt/caudium/server/

2.

php-x.y.z (x.y.z ) 3.

./configure --with-caudium=/opt/caudium/server 4.

make 5.

make install 6.

Caudium 7.

GUI PHP 4 8.

Add Module PHP 4 Script Support module 9.

'PHP 4 interpreter isn't available'

PHP4.so

/opt/caudium/logs/debug/default.1

caudium/server/lib/[pike-version]/PHP4.so

10. PHP Script Support module

PHP 4 PHP Caudium : MySQL PHP 4 MySQL MySQL Pike --with-mysql MySQL

fhttpd PHP fhttpd "Build as an fhttpd module?" "yes" (configure --with-fhttpd=DIR) fhttpd /usr/local/src/fhttpd fhttpd PHP / : PHP4.3.0 fhttpd

Sun, iPlanet, Netscape Sun Solaris Sun Solaris Sun Java System Web Server, Sun ONE Web Server, iPlanet and Netscape server PHP PHP 4.3.3 NSAPI Apache Web Netscape Enterprise Server (NES) PHP http://benoit.noss.free.fr/php/install-php4.html Sun JSWS/Sun ONE WS/iPlanet/Netscape Web PHP --with-nsapi=[DIR] /opt/netscape/suitespot/

/php-xxx-version/sapi/nsapi/nsapi-readme.txt 1 . http://www.sunfreeware.com/

autoconf-2.13

13 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

automake-1.4 bison-1_25-sol26-sparc-local flex-2_5_4a-sol26-sparc-local gcc-2_95_2-sol26-sparc-local gzip-1.2.4-sol26-sparc-local m4-1_4-sol26-sparc-local make-3_76_1-sol26-sparc-local mysql-3.23.24-beta (mysql ) perl-5_005_03-sol26-sparc-local tar-1.13 (GNU tar)2 . ( PATH=.:/usr/local/bin:/usr/sbin:/usr/bin:/usr/ccs/bin ) exportPATH 3 . gunzip php-x.x.x.tar.gz (.gz ) 4. tar xvf php-x.x.x.tar 5 . PHP cd ../php-x.x.x 6 . /opt/netscape/suitespot/ netscape ./configure --with-mysql=/usr/local/mysql --with-nsapi=/opt/netscape/suitespot/ --enable-libgcc 7 . make make install readme Sun/iPlanet/Netscape

LD_LIBRARY_PATH Web /path/to/server/https-servername/start

/path/to/server/https-servername/config/ 1 . mime.types (administration server ) type=magnus-internal/x-httpd-php exts=php

2 . magnus.conf (>= 6) obj.conf (< 6) shlib /opt/netscape/suitespot/bin/libphp4.so mime types init Init fn="load-modules" funcs="php4_init,php4_execute,php4_auth_trans" shlib="/opt/netscape/suitespot/bin/libphp4.so" Init fn="php4_init" LateInit="yes" errorString="Failed to initialize PHP!" [php_ini="/path/to/php.ini"] (PHP >= 4.3.3) php_ini Web php.ini 3 . obj.conf 6 vserver.obj.conf . . . .#NOTE this next line should happen after all 'ObjectType' and before all 'AddLog' lines Service fn="php4_execute" type="magnus-internal/x-httpd-php" [inikey=value inikey=value ...] . . (PHP >= 4.3.3) php.ini php4_execute docroot="/path/to/docroot" 0/1 "On","Off",... zlib.output_compression="On" zlib.output_compression=1 4. cgi-bin PHP ObjectType fn="force-type" type="magnus-internal/x-httpd-php" Service fn=php4_execute [inikey=value inikey=value ...] Administration Server x-httpd-php PHP .html PHP 5 . PHP PHP

14 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

PHP AuthTrans fn=php4_auth_trans . . . 6 . PHP AuthTrans fn=php4_auth_trans : PHP Web PHP Administration Server "MAGNUS EDITOR"

CGI php.ini Sun JSWS/Sun ONE WS/iPlanet/Netscape Web PHP Web 1 PATH_INFO HTTP_HOST CGI PHP 3.x getenv() $_ENV Web CGI : CGI Web Administration Server Web CGI Web CGI Administration Server Web CGI PHP 4.x CGI $_SERVER $HTTP_HOST php.ini register_globals (variables_order) "E" variables_order = "GPCS" register_globals = On

(PHP >= 4.3.3)PHP "404 Not Found" obj.conf Error fn="php4_execute" code=XXX script="/path/to/script.php" [inikey=value inikey=value...] XXX HTTP Error code HTTP

$_SERVER['ERROR_TYPE'] PHP PHP obj.conf

type="magnus-internal/directory" Service fn="php4_execute" type="magnus-internal/directory" script="/path/to/script.php" [inikey=value inikey=value...] URI URI $_SERVER['PATH_INFO']

$_SERVER['PATH_TRANSLATED']

nsapi_virtual() (PHP >= 4.3.3)NSAPI nsapi_virtual() (: virtual()) Web Web NSAPI nsapi_virtual() : nsapi_virtual()

CGI PHP CGI CGI Web PHP PHP Web PHP CGI ID PHP

15 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

CGI CGI PHP4.3.0 PHP CLI (Command Line Interface) SAPI CGI configure {PREFIX}/bin/php PHP

PHP CGI make test PHP

PHP 3 CGI make bench on 30 set_time_limit() max_execution_time make bench : make bench PHP 3

CGI/1.1

AUTH_TYPE, CONTENT_LENGTH, CONTENT_TYPE, GATEWAY_INTERFACE, PATH_INFO, PATH_TRANSLATED, QUERY_STRING, REMOTE_ADDR, REMOTE_HOST, REMOTE_IDENT, REMOTE_USER, REQUEST_METHOD, SCRIPT_NAME, SERVER_NAME, SERVER_PORT, SERVER_PROTOCOL, SERVER_SOFTWARE

HP-UX HP-UX PHP HP-UX http://software.hp.com/ PHP () HP-UX Building Apache and PHP on HP-UX 11.11

OpenBSD PHP OpenBSD 3.6

OpenBSD PHP OpenBSD CD FTP php4-core-4.3.8.tgz ( gettext iconv)

php4-mysql-4.3.8.tgz php4-imap-4.3.8.tgz php.ini / phpxs Example#1 OpenBSD # # #

# #

# #

# #

pkg_add php4-core-4.3.8.tgz /usr/local/sbin/phpxs -s cp /usr/local/share/doc/php4/php.ini-recommended /var/www/conf/php.ini (add in mysql) pkg_add php4-mysql-4.3.8.tgz /usr/local/sbin/phpxs -a mysql (add in imap) pkg_add php4-imap-4.3.8.tgz /usr/local/sbin/phpxs -a imap (remove mysql as a test) pkg_delete php4-mysql-4.3.8 /usr/local/sbin/phpxs -r mysql (install the PEAR libraries)

16 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html# pkg_add php4-pear-4.3.8.tgz OpenBSD man packages(7)

Ports ports PHP OpenBSD PHP 4 core, extensions 2 extensions PHP no_* FLAVOR imap FLAVOR no_imap

Apache chroot(2) jail PHP /var/www /var/www/tmp jail localhost listen /etc /etc/resolv.conf /etc/services /var/www/etc OpenBSD PEAR chroot OpenBSD Apache OpenBSD FAQ OpenBSD 3.6 gd XFree86 X11 php4-gd-4.3.8-no_x11.tgz

OpenBSD PHP FLAVORS ports OpenBSD port Anil Madhavapeddy (avsm at openbsd dot org)

Solaris Solaris PHP

Solaris C GNU FAQ gcc (C ) make flex bison m4 autoconf automake perl gzip tar GNU sed (Oracle MySQL)

pkgadd

Debian GNU/Linux Debian GNU/Linux PHP

APT PHP Debian Linux

17 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

Apache 1.3.x Apache 2.x libapache-mod-php* libapache2-mod-php* Apache 1.3.x PHP 5 Debian PHP 4 Debian PHP CGI CLI php4-cgi php4-cli php4-pear pear PEAR Debian Debian PHP http://www.apt-get.org/ Dotdeb Guillaume Plessis PHP 4 PHP 5 Debian /etc/apt/sources.lists apt-get update Example#1 Dotdeb apt line deb http://packages.dotdeb.org stable all deb-src http://packages.dotdeb.org stable all apt-get update Apache PHP Apache PHP Example#2 Debian Apache 1.3 # apt-get install libapache-mod-php4 APT Apache 1.3 PHP 4 Apache Example#3 PHP 4 Apache # /etc/init.d/apache stop # /etc/init.d/apache start

PHP MySQL cURL, GD PHP configure APT 'php4-*' PHP 5 'php5-*' Example#4 # dpkg -l 'php4-*' (php4-cgi php4-cli, php4-pear ) APT MySQL, cURL GD PHP Example#5 MySQL, cURL GD PHP # apt-get install php4-mysql php4-curl php4-gd APT php.ini (/etc/php4/apache/php.ini, /etc/php4/cgi/php.ini ) Example#6 MySQL, cURL GD extension=mysql.so extension=curl.so extension=gd.so Apache

PHP PHP APT /etc/apache/conf.d/php4 Apache 1.3

/etc/apache/httpd.conf Apache Example#7 PHP 4 Apache # Include /etc/apache/conf.d/

18 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

php.ini debconf

Mac OS X PHP Mac OS X Mac OS X PHP Mac OS X 2 Mac OS X PHP MacOS 9

Mac OS X PHP PHP Mac OS PHP MacPorts: http://www.macports.org/ Entropy: http://www.entropy.ch/software/macosx/php/ Fink: http://fink.sourceforge.net/

PHP PHP OS X 10.0.0 Mac PHP Apache httpd.conf CGI CLI ( ) PHP PHP PHP MAC OS X mod_php Mac OS X Apache web server (System Preferences ) mod_php 1 . Apache /etc/httpd/httpd.conf Finder Spotlight root : Unix nano root sudo (root ) sudo nano

/etc/httpd/httpd.conf () nano ^w() ^o () ^x () ^ Ctrl 2 . ( ) (# ) # LoadModule php4_module libexec/httpd/libphp4.so # AddModule mod_php4.c

PHP 3 . (: .php .html .inc) PHP

19 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

httpd.conf (Mac Panther ) PHP .php PHP

# If php is turned on, we respect .php and .phps files.

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

# Since most users will want index.php to work we

# also automatically enable index.php

DirectoryIndex index.html index.php

4. DirectoryIndex httpd.conf

index.php index.html index.php 5 . php.ini Mac OS X /usr/local/php/php.ini phpinfo() php.ini PHP php.ini ? FAQ 6 . DocumentRoot PHP PHP /Library/WebServer/Documents httpd.conf DocumentRoot

/Users/yourusername/Sites 7 . phpinfo() phpinfo() PHP DocumentRoot PHP

$WScript->Echo("Hello World!"); Hello World! : PHP 4ActivePHP PHP 4PHPScript ActivePHP : ActiveScript php.ini .exe php-activescript.ini

Microsoft IIS / PWSIIS (Microsoft Internet Information Server)

26 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

CGI CGI

IIS PWS PHP Windows PHP CGI php.ini cgi.force_redirect PHP 0 cgi.force_redirect FAQ CGI cgi.redirect_status_env php.ini PHP 4 CGI php.exe PHP 5 php-cgi.exe PHP 5 php.exe CLI CGI Windows PATH PHP PHP DLL PHP PHP Windows FAQ PATH IIS ( IUSR_MACHINENAME) php.ini

php.ini extension_dir doc_root PHP PHP 4 extension_dir extensions PHP 5 ext PHP 5 extensions_dir "c:phpext" IIS doc_root "c:Inetpubwwwroot"

php_mysql.dll php_curl.dll PHP DLL zip PHP () PHP 5 PECL "Collection of PECL modules" php_zip.dll php_ssh2.dll PHP IIS ( PWS) PHP PHP CGI 404 PHP 32bit 64bit Windows 32bit IIS IIS Cscript.exe adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1

Windows NT/200x/XP IIS 4 PHP CGI ISAPI (Windows NT 4.0 Windows 2000/XP =>) Web ( Web ) CGI CGI PHP 5 C:phpphp-cgi.exe .php OK ( ) NT NTFS php.exe / php-cgi.exe I_USR_ ISAPI PHP HTTP ISAPI PHP php4isapi.dll / php5isapi.dll ISAPI DLL PHP 5 C:phpphp5isapi.dll .php OK IIS (NET STOP iisadmin) IIS (NET START w3svc) IIS 6 (2003 Server) IIS Web Web PHP ISAPI (php4isapi.dll php5isapi.dll) CGI (php.exe

php-cgi.exe) OK

27 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

index.php (: Web ) index.php OK Apache DirectoryIndex PHP .php .php3 CPU 100% IIS ISAPI

Windows PWS 4PWS 4 ISAPI PHP CGI pws-php4cgi.reg / pws-php5cgi.reg (PHP 4 SAPI PHP 5 php.exe / php-cgi.exe

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesw3svcparametersScript Map] ".php"="C:phpphp.exe"(PHP 5 C:phpphp-cgi.exe ) PWS PHP

Windows PWS/IIS 3PWS/IIS 3 REG (SAPI pws-php4cgi.reg PHP 4

pws-php5cgi.reg PHP 5 ) PHP Windows PHP Regedit

HKEY_LOCAL_MACHINE /System /CurrentControlSet /Services /W3Svc /Parameters /ScriptMap -> PHP .php php.exe PHP 4 C:phpphp.exe "%s"

%s PHP 5 C:phpphp-cgi.exe "%s" %s PHP Web PHP (:

C:myscriptstest.php )

HKEY_CLASSES_ROOT -> .php () phpfile

HKEY_CLASSES_ROOT -> phpfile phpfile () PHP Script

phpfile -> Shell Shell -> open open -> command command () php.exe

c:phpphp.exe -q %1 %1 Regedit Windows PWS PWS IIS 3 IIS 3 Steven Genusa

Apache 1.3.x Microsoft Windows Microsoft Windows Apache 1.3.x PHP Apache 2 PHP :

28 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

PHP Windows Apache 1.3.x 2 CGI (PHP 4 php.exe PHP 5

php-cgi.exe) Apache DLL httpd.conf Apache PHP Apache Windwos SAPI CGI SAPI Apache PHP Apache Apache Windows NET STOP APACHE NET START APACHE : Windows Apache c:directoryfile.ext c:/directory/file.ext

Apache Apache httpd.conf Example#1 Apache 1.3.x PHP PHP c:php PHP 4 # LoadModule # sapi ! LoadModule php4_module "C:/php/php4apache.dll" # AddModule AddModule mod_php4.c PHP 5 # LoadModule LoadModule php5_module "C:/php/php5apache.dll" # AddModule AddModule mod_php5.c # AddType application/x-httpd-php .php # .phps AddType application/x-httpd-php-source .phps

CGI PHP C:php Apache CGI Example#2 Apache 1.3.x CGI PHP ScriptAlias /php/ "c:/php/" AddType application/x-httpd-php .php # PHP 4 Action application/x-httpd-php "/php/php.exe" # PHP 5 Action application/x-httpd-php "/php/php-cgi.exe" # php.ini SetEnv PHPRC C:/php 2 httpd.conf c:/php/ CGI CGI PHP Apache CGI PHP highlight_file() PHP

29 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

Apache 2.0.x Microsoft Windows Microsoft Windows Apache 2.0.x PHP Apache 1.3 PHP : : Apache 2.2.x Apache 2.2.x DLL

php5apache2_2.dll PHP 5.2.0 http://snaps.php.net/ Apache2 MPM prefork MPM Apache1 MPM Apache2 FAQ Apache Apache 2.0.x Apache 2.0.x Windows : PHP Apache 2.0.x PHP Apache 2.0.x PHP 4.3.0 ( http://www.php.net/downloads.php ) http://snaps.php.net/php5-latest.tar.gz Windows http://snaps.php.net/win32/php5-win32-latest.zip http://qa.php.net/ anonymous CVS PHP PHPApache 2.0.40 Apache 2.0 SAPI PHP 4.2.0 PHP 4.2.3 Apache 2.0.39 PHP 4.2.3 Apache PHP 4.3.0 PHP Apache2 PHP Apache 1.3.x Apache 2.0.x Windows NT 4.0, Windows 2000 Windows XP Windows 9x Apache 2.0.x PHP PHP Apache PHP Windows Apache 2.0.x 2 CGI Apache DLL httpd.conf Apache PHP Apache : Windows Apache c:directoryfile.ext c:/directory/file.ext

CGI CGI Apache httpd.conf Example#1 Apache 2.0 CGI PHP ScriptAlias /php/ "c:/php/" AddType application/x-httpd-php .php # PHP 4 Action application/x-httpd-php "/php/php.exe" # PHP 5 Action application/x-httpd-php "/php/php-cgi.exe" CGI CGI

Apache Apache 2.0 PHP Apache httpd.conf

30 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

Example#2 Apache 2.0 PHP # PHP 4 LoadModule php4_module "c:/php/php4apache2.dll" # sapi php4apache2.dll ! AddType application/x-httpd-php .php # PHP 5 LoadModule php5_module "c:/php/php5apache2.dll" AddType application/x-httpd-php .php # php.ini PHPIniDir "C:/php" : c:/php/ LoadModule php4apache2.dll

php5apache2.dll php4apache.dll php5apache.dll Apache 1.3.x : FAQ

PHP DLL DLL PHP

Sun, iPlanet, Netscape Microsoft Windows Windows Sun Java System Web Server, Sun ONE Web Server, iPlanet and Netscape server PHP PHP 4.3.3 NSAPI Apache WEB

Sun, iPlanet, Netscape CGI PHP CGI PHP

php4ts.dll Windows 2 assoc .php=PHPScript ftype PHPScript=c:phpphp.exe %1 %* Netscape Enterprise Administration Server shellcgi 5 obj.conf Web shellcgi Netscape Enterprise Administration Server mime type (Category: type, Content-Type: magnus-internal/shellcgi, File Suffix:php) PHP Web CGI PHP http://benoit.noss.free.fr/php/install-php.html

Sun, iPlanet, Netscape NSAPI PHP NSAPI PHP

php4ts.dll Windows 2 assoc .php=PHPScript ftype PHPScript=c:phpphp.exe %1 %* Netscape Enterprise Administration Server mime type (Category: type, Content-Type: magnus-internal/shellcgi, File Suffix:php)

magnus.conf (>= 6) obj.conf (< 6) mime types init Init fn="load-modules" funcs="php4_init,php4_execute,php4_auth_trans" shlib="c:/php/sapi/php4nsapi.dll" Init fn="php4_init" LateInit="yes" errorString="Failed to initialise PHP!" [php_ini="c:/path/to/php.ini"] (PHP >= 4.3.3) php_ini Web php.ini

obj.conf vserver.obj.conf [SunONE 6.0] < Object name="default" > 'ObjectType' 'AddLog'

31 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.htmlService fn="php4_execute" type="magnus-internal/x-httpd-php" [inikey=value inikey=value ...] (PHP >= 4.3.3) php.ini php4_execute docroot="/path/to/docroot" "On","Off",... 0/1 zlib.output_compression="On" zlib.output_compression=1 cgi-bin PHP ObjectType fn="force-type" type="magnus-internal/x-httpd-php" Service fn=php4_execute [inikey=value inikey=value ...] Administration Server x-httpd-php PHP .html PHP Web PHP Web : NSAPI PHP http://benoit.noss.free.fr/php/install-php4.html : PHP WEB PHP Administration Server "MAGNUS EDITOR"

CGI php.ini Sun JSWS/Sun ONE WS/iPlanet/Netscape WEB PHP WEB PATH_INFO HTTP_HOST CGI PHP 3.x getenv() $_ENV WEB CGI : CGI WEB Administration Server WEB CGI WEB CGI Administration Server WEB CGI PHP 4.x CGI $_SERVER $HTTP_HOST php.ini register_globals (variables_order) "E" variables_order = "GPCS" register_globals = On

(PHP >= 4.3.3)PHP "404 Not Found" obj.conf Error fn="php4_execute" code=XXX script="/path/to/script.php" [inikey=value inikey=value...] XXX HTTP Error code HTTP

$_SERVER['ERROR_TYPE'] PHP PHP obj.conf

type="magnus-internal/directory" Service fn="php4_execute" type="magnus-internal/directory" script="/path/to/script.php" [inikey=value inikey=value...] URI URI $_SERVER['PATH_INFO']

$_SERVER['PATH_TRANSLATED']

nsapi_virtual() (PHP >= 4.3.3)NSAPI nsapi_virtual() (: virtual()) WEB WEB NSAPI Unix nsapi_virtual() Windows DLL ns-httpdXX.dll 6.1 Sun nsapi_virtual()

32 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

magnus.conf/obj.conf php4_init Init fn=php4_init ... server_lib="ns-httpdXX.dll" XX DLL DLL phpinfo() : nsapi_virtual()

OmniHTTPd Windows OmniHTTPd PHP : CGI CGI PHP OmniHTTPd CGI OmniHTTPd SAPI ISPAI PHP : CGI PHP cgi.force_redirectFAQ

0 1 . OmniHTTPd 2 . OmniHTTPd Properties 3 . Web Server Global Settings 4. virtual = .php | actual = c:path-to-php-dirphp.exe External Add 5 . virtual = wwwserver/stdcgi | actual = .php Mime Add 6 . OK PHP 26 : PHP OmniHTTPd PHP PHP4 OmniHTTPd PHP PHP 4,5

Sambar Microsoft Windows Windows Sambar Server PHP : Windows Sambar ISAPI PHP Sambar ( config ) mappings.ini

mappings.ini [ISAPI] Example#1 Sambar ISAPI # PHP 4 *.php = c:phpphp4isapi.dll # PHP 5 *.php = c:phpphp5isapi.dll (PHP c:php ) Sambar : PHP Sambar Server

33 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

Sambar Server LocalSystem

XitamiMicrosoft Windows Windows Xitami PHP : Windows Xitami PHP CGI : CGI PHP cgi.force_redirectFAQ

0 $_SERVER['PHP_SELF'] cgi.fix_pathinfo CGI CGI Web Xitami http://127.0.0.1/admin Configuration Filtersphp (.php ) File extensions (.xxx) Filter command or scriptCGI PHP (c:phpphp.exe) Save

Windows PHP PHP cygwin Unix

Build EnvironmentPHP Microsoft Visual C++ 6.0 () Microsoft Visual C++ .NET Microsoft Visual C++ 2005, Windows Platform SDK .NET Framework SDK () Windows VC6 (Microsoft Visual C++ 6.0) Microsoft Windows PHP Microsoft Visual C++ 2005 Express Edition Microsoft Visual C++ 2005 Express : 1 Microsoft Visual C++ 2005 Express 3 3 Microsoft Visual C++ 2005 Express Microsoft Windows Server 2005 Platform SDK .NET Framework 2.0 Software Development Kit MSVC 2005 Express Windows Platform SDK PHP Windows Platform SDK WinResrc.h SDK Include winres.h PHP MSVC 2005 Express vsvars32.bat C:Program FilesMicrosoft Visual Studio 8Common7Tools () PATH INCLUDE LIB SDK bininclude

34 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

lib : .NET SDK vsvars32.bat SDK Microsoft Visual C++ 2005 Express

ZIP Windows XP ZIP http://www.php.net/extra/win32build.zip win32 http://www.php.net/extra/bindlib_w32.zip PHP DNS win32build.zip

resolv.lib PHP Apache Apache PHP anonymous CVS tar

C:work (C:work) win32build win32build.zip (C:work) bindlib_w32 bindlib_w32.zip (C:work) PHP ( )

C:workwin32buildinclude C:workwin32buildlib cygwin bison flex configure

C:workwin32buildbin PATH +--C:work |

| |

+--bindlib_w32 |

|

| |

|

+--arpa |

|

| |

|

+--conf |

|

| |

|

+--... |

| |

+--php-5.x.x |

|

| |

|

+--build |

|

| |

|

+--... |

|

| |

|

+--win32 |

|

| |

|

+--... |

| |

+--win32build |

|

| |

|

+--bin |

|

| |

|

+--include |

|

| |

|

+--lib

Cygwin C:usrlocallib C:workwin32buildbin bison.simple

C:usrlocallib : PEAR CLI-SAPI PEAR PEAR web

resolv.lib resolv.lib (bindlib - Win32 Debug) (bindlib - Win32 Release) PHP GUI C:workbindlib_w32bindlib.dsw VC++ Build=>Rebuild All

35 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

C++ vcvars.bat msdev bindlib.dsp /MAKE "bindlib - Win32 Debug" msdev bindlib.dsp /MAKE "bindlib - Win32 Release" resolv.lib C:workbindlib_w32Debug Release

C:workwin32buildlib

PHP [PHP >=5 ] PHP >=5 CLI Unix PHP : PHP 4 Libxml ICU ( PHP >= 6 ) Visual Studio cd C:workphp-5.x.x PHP PHP buildconf config.w32 config.w32 pecl; ..pecl; peclrpc; ..peclrpc PHP 5.1.0

--add-modules-dir ( cscript /nologo win32/build/buildconf.js--add-modules-dir=../php-gtk2 --add-modules-dir=../pecl) cscript /nologo configure.js --help / cscript /nologo configure.js --disable-foo --enable-fun-ext --enable-foo=shared 'foo' nmake ( .exe .dll)

Release_TS Debug_TS () Release Debug PHP nmake test 'TESTS' ( nmake /D TESTS=ext/sqlite/tests test - sqlite ) nmake clean --enable-snapshot-build (nmake build-snap) () SAPI

DSW PHP [PHP 4]DSW PHP PHP 5 Windows PHP 4 MVC ++ MVC++ Microsoft Visual C++ => : C:workwin32buildbin, Cygwin : C:cygwinbin : C:workwin32buildinclude : C:workwin32buildlib CGI GUI VC++ => C:workphp-4.x.xwin32php4ts.dsw => php4ts - Win32 Debug_TS php4ts - Win32 Release_TS => C++ vcvars.bat

C:workphp-4.x.xwin32

36 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

msdev php4ts.dsp /MAKE "php4ts - Win32 Debug_TS" msdev php4ts.dsp /MAKE "php4ts - Win32 Release_TS" C:workphp-4.x.xDebug_TS Release_TS php.exe

main/config.win32.h php.ini PHP CLI php4ts_cli - Win32 Debug_TS php4ts_cli - Win32

Release_TS CGI Release_TScli Debug_TScli php.exe Microsoft IIS PHP SAPI (php4isapi.dll)

php4isapi-whatever-config dll

Windows PHP Windows PHP Web PHP php.ini PHP dl() PHP DLL 'php_' Windows PHP DLL extension DLL () Windows PHP PHP PHP 4 (PHP 4.3.11 ): BCMath Caledar COM Ctype FTP MySQL ODBC Overload PCRE Session Tokenizer WDDX XML Zlib PHP 5 (PHP 5.0.4 ) DOM LibXML Iconv SimpleXML SPL SQLite MySQL Overload

PHP PHP 4 C:php4extensions PHP 5 C:php5 php.ini extension_dir php_*.dll extension_dir = c:phpextensions

php.ini php.ini extension=php_*.dll ; Example#1 Windows PHP Bzip2 // ;extension=php_bz2.dll // extension=php_bz2.dll DLL DLL PHP 4 C:phpdlls PHP 5 DLL Oracle (php_oci8.dll) DLL PHP 4 DLL C:phpdlls C:php C:php FAQ DLLs PHP PECL PECL PHP PECL : PHP Web php.ini Web DLL

37 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

PHP php_bz2.dll php_calendar.dll php_cpdf.dll php_crack.dll php_ctype.dll php_curl.dll php_cybercash.dll php_db.dll php_dba.dll php_dbase.dll php_dbx.dll php_domxml.dll php_dotnet.dll php_exif.dll php_fbsql.dll php_fdf.dll php_filepro.dll php_ftp.dll php_gd.dll php_gd2.dll php_gettext.dll php_hyperwave.dll php_iconv.dll php_ifx.dll php_iisfunc.dll php_imap.dll php_ingres.dll php_interbase.dll php_java.dll php_ldap.dll php_mbstring.dll php_mcrypt.dll php_mhash.dll bzip2 ClibPDF Crack (ctype) CURL, Client URL Library Cybercash DBM DBA: (dbm ) dBase dbx DOM XML .NET EXIF FrontBase FDF: Forms Data Format filePro FTP (GD ) (GD2 ) Gettext HyperWave ICONV Informix IIS management IMAP,POP3,NNTP Ingres II InterBase Java LDAP Mcrypt Mhash Ingres II PHP = 4.3.0 PHP 4.3.0 PHP 4.0.3

libeay32.dll ssleay32.dll PHP = 5.0.0libmysql.dll (PHP PHP ?> ( ) echo() print() PHP PHP 4 2 2 ASP php.ini ASP : PHP XML XHTML Example#2 PHP 1.

2.

echo '(FrontPage)

';

3.

This is a shortcut for "" 4.

1. 2. 1. 3.php.ini short_open_tag PHP --enable-short-tags configure : PHP 3 short_tags() PHP 3 ! ASP 4. php.ini asp_tags : ASP 3.0.4 : PHP

C Perl PHP PHP PHP "" PHP // ... ?> # ... ?> HTML ?> PHP HTML // # asp_tags // %> # %>

PHP '

' 'C' */ 'C'

(boolean) NULL

PHP 8 4 : (boolean) (integer) float (, 'double' ) (string) 2 : (array) (object) 2 : (resource) (NULL)

45 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

mixed number callback $... "double" double float 2 PHP : var_dump() gettype() gettype() is_type

settype() PHP

(boolean)boolean TRUE FALSE : PHP 4

boolean TRUE FALSE boolean

boolean boolean (bool) (boolean) boolean

46 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

boolean FALSE boolean FALSE integer 0 () float 0.0 () "0" (PHP 4) NULL () SimpleXML TRUE ( resource)

-1 () TRUE bool(false) bool(true) bool(true) bool(true) bool(true) bool(true) bool(false) bool(true)

integer Z = {..., -2, -1, 0, 1, 2, ...} / GMP float / BCMath

(integer) 10 ( 10)16 ( 16)8 ( 8) (-+) 8 0 () 16 0x Example#1 decimal

: [1-9][0-9]*

|0 hexadecimal : 0[xX][0-9a-fA-F]+ octal

integer

: 0[0-7]+ : [+-]?decimal | [+-]?hexadecimal | [+-]?octal

20 (32 ) PHP PHP_INT_SIZE PHP 4.4.0 PHP 5.0.5 PHP_INT_MAX 8 : 8 9 Example#2 8

integer float integer float

47 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

-50000 * $million -429496728 PHP 4.1.0 PHP 1/2 float 0.5 round()

integer (int) (integer) integer intval() booleans FALSE 0 () TRUE 1 float float ( +/- 2.15e+9 = 2^31) undefined float ! integer float

48 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

("float", "double", "" ) : LNUM

[0-9]+ DNUM

([0-9]*[.]{LNUM}) | ({LNUM}[.][0-9]*) EXPONENT_DNUM ( ({LNUM} | {DNUM}) [eE][+-]? {LNUM}) float 10 14 ~1.8e308 ( 64 IEEE )

0.1 0.7 floor((0.1+0.7)*10) 7 8 () 7.9999999999... 1/3 0.3333333. .

. gmp

float PHP 5

string PHP 1 256 PHP Unicode Unicode utf8_encode() utf8_decode() : PHP

3 ( ') () ! : PHP 3 E_NOTICE : () Search

Find

Go (q ), action Web HTML

application/x-www-form-urlencoded XFormsXMLXFormsXML $HTTP_RAW_POST_DATA XML XSLT $_POST method

urlencoded-post application/x-www-form-urlencoded Example#2 XForm$_POST

159 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html Search

Find

Go : XForms

PUT

POST PHP PHP RFC-1867 (Netscape Navigator 3 Microsoft Microsoft Internet Explorer 3 ) : php.ini file_uploads, upload_max_filesize, upload_tmp_dir, post_max_size, max_input_time PHP Netscape Composer W3C Amaya PUT PUT Example#1

:

__URL__ PHP hidden MAX_FILE_SIZE input file PHP PHP

MAX_FILE_SIZE : enctype="multipart/form-data" $_FILES PHP 4.1.0 ($HTTP_POST_FILES ) $_FILES userfile

$_FILES['userfile']['name']

160 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

$_FILES['userfile']['type'] MIME "image/gif" MIME PHP

$_FILES['userfile']['size']

$_FILES['userfile']['tmp_name']

$_FILES['userfile']['error'] ['error']PHP 4.2.0

php.ini upload_tmp_dir PHP TMPDIR PHP putenv() Example#2 is_uploaded_file() move_uploaded_file() PHP $_FILES['userfile']['size'] $_FILES['userfile']['type'] PHP PHP 4.2.0 $_FILES['userfile']['error'] PHP $_FILES['userfile']['size'] 0

$_FILES['userfile']['tmp_name'] Example#3 PHP HTML Pictures:

161 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

PHP 4.2.0 PHP PHP ['error'] $_FILES['userfile']['error'] UPLOAD_ERR_OK : 0; UPLOAD_ERR_INI_SIZE : 1; php.ini upload_max_filesize UPLOAD_ERR_FORM_SIZE : 2; HTML MAX_FILE_SIZE UPLOAD_ERR_PARTIAL : 3; UPLOAD_ERR_NO_FILE : 4; UPLOAD_ERR_NO_TMP_DIR : 6; PHP 4.3.10 PHP 5.0.3 UPLOAD_ERR_CANT_WRITE : 7; PHP 5.1.0 UPLOAD_ERR_EXTENSION : 8; PHP 5.2.0 : PHP 4.3.0 PHP

MAX_FILE_SIZE upload_max_filesize 2 memory_limit memory_limit max_execution_time max_execution_time : max_execution_time system() sleep() post_max_size post_max_size CERN httpd content-type MIME CERN httpd foo[]

input name

162 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

HTML : 3.0.10 Example#1

Send these files:


$_FILES['userfile'], $_FILES['userfile']['name'], $_FILES['userfile']['size'] (4.1.0 PHP $HTTP_POST_FILES) register_globals on /home/test/review.html /home/test/xwp.out

$_FILES['userfile']['name'][0] review.html $_FILES['userfile']['name'][1] xwp.out $_FILES['userfile']['size'][0] review.html $_FILES['userfile']['name'][0], $_FILES['userfile']['tmp_name'][0], $_FILES['userfile']['size'][0], $_FILES['userfile']['type'][0]

PUT PHP HTTP PUT PUT POST PUT /path/filename.html HTTP/1.1 /path/filename.html Web Apache PHP Web PHP web Apache Script Apache Script PUT /put.php URI PUT put.php Apache .php PHP PHP PUT PHP 4 put.php myputfile.ext Example#1 PHP 4 HTTP PUT : PHP 3 Example#2 PHP 3 HTTP PUT () FTP fopen() 'anonymous'URL 'ftp://user:[email protected]/path/to/file' ( ) (BasicHTTP ) Example#2 : fopen() syslog()

: PHP 3.0.7 PHP 3 0 - NORMAL 1 - ABORTED 2 - TIMEOUT PHP NORMAL ABORTED STOP PHP (set_time_limit() ) TIMEOUT

164 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

php.ini ignore_user_abort Apache .conf "php_value ignore_user_abort" ignore_user_abort() PHP register_shutdown_function() STOP PHP connection_aborted() TRUE 30 php.ini max_execution_time Apache .conf php_value max_execution_time set_time_limit() connection_status() 2 ABORTED TIMEOUT PHP PHP connection_status() 3

PHP( ) '' () Web ''

? WebWeb PHPWeb3 CGI ""PHP PHPWeb(PHP ) (SQL ) 2PHPWeb( Apache) Web() () 2 SQL SQL PHPWeb PHP 4 ISAPI, WSAPI, NSAPI (Windows) Netscape FastTrackMicrosoft Internet Information Server (IIS)O'Reilly WebSite Pro PHP SAPIPHP 3 ? SQL WebSQL SQL 20 SQL SQL20 16 17 ( )16

165 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

register_shutdown_function() ( ) 11 ( )! See also fbsql_pconnect(), ibase_pconnect(), ifx_pconnect(), ingres_pconnect(), msql_pconnect(), mssql_pconnect(), mysql_pconnect(), ociplogon(), odbc_pconnect(), ora_plogon(), pfsockopen(), pg_pconnect(), sybase_pconnect()

PHP PHP Web OS ISP PHP 6.0.0

safe_mode safe_mode_gid safe_mode_include_dir safe_mode_exec_dir safe_mode_allowed_env_vars "0" "0" NULL "" "PHP_"

PHP_INI_SYSTEM PHP 6.0.0 PHP_INI_SYSTEM PHP 4.1.0 PHP 6.0.0 PHP_INI_SYSTEM PHP 4.1.0 PHP 6.0.0 PHP_INI_SYSTEM PHP 6.0.0 PHP_INI_SYSTEM PHP 6.0.0

safe_mode_protected_env_vars "LD_LIBRARY_PATH" PHP_INI_SYSTEM PHP 6.0.0 open_basedir disable_functions disable_classes NULL "" "" PHP_INI_ALL PHP < 6 PHP_INI_SYSTEM PHP 4.0.1 PHP 4.3.2

php.ini only php.ini only

PHP_INI_* ini_set()

safe_mode boolean

safe_mode_gid boolean UIDGID safe_mode_gid UID (FALSE) GID (TRUE)

safe_mode_include_dir string

166 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

UID/GID include_path PHP 4.2.0 include_path (Windows) "safe_mode_include_dir = /dir/incl" "/dir/include" "/dir/incls" "safe_mode_include_dir = /dir/incl/" PHP 4.2.3 PHP 4.3.3 UID/GID

safe_mode_exec_dir stringPHPsystem() Windows /

safe_mode_allowed_env_vars string PHP_(e.g. PHP_FOO=BAR) : PHP

safe_mode_protected_env_vars stringputenv() safe_mode_allowed_env_vars

open_basedir stringPHP / fopen() gzopen() PHP

open_basedir . chdir()

httpd.confopen_basedir (: ) "php_admin_value open_basedir none" Windows Apacheopen_basedir "open_basedir = /dir/incl" "/dir/include" "/dir/incls" "open_basedir = /dir/incl/" : 3.0.7

disable_functions string disable_functions php.ini httpd.conf

disable_classes string disable_classs php.ini

httpd.conf: Availability note PHP4.3.2 register_globals, display_errors, log_errors onPHP -rw-rw-r--

1 rasmus

rasmus

33 Jul

1 19:20 script.php -rw-r--r--

1 root

root

1116 May 26 18:01 /etc/passwd

167 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

script.php Warning: SAFE MODE Restriction in effect. The script whose uid is 500 is not allowed to access /etc/passwd owned by uid 0 in /docroot/script.php on line 2

UID checking. UID GID safe_mode_gid On GIDOff UID safe_mode open_basedir (Apachehttpd.conf):

php_admin_value open_basedir /docroot open_basedir script.php: Warning: open_basedir restriction in effect. File is in wrong directory in /docroot/script.php on line 2

disable_functions php.ini

httpd.conf php.ini: disable_functions = readfile,system

: Warning: readfile() has been disabled for security reasons in /docroot/script.php on line 2

PHP

safe-mode

168 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

dbmopen() dbase_open() filepro() filepro_rowcount() filepro_retrieve() ifx_*() ingres_*() mysql_*() pg_lo_import() posix_mkfifo() putenv() move_uploaded_file() chdir() dl() backtick operator shell_exec() (functional equivalent of backticks) exec() /UID /UID /UID /UID /UID sql_safe_mode restrictions, (!= safe mode) sql_safe_mode restrictions, (!= safe mode) sql_safe_mode restrictions, (!= safe mode) /UID UID inisafe_mode_protected_env_vars safe_mode_allowed_env_vars putenv() /UID UID safe-mode safe-mode safe-mode safe_mode_exec_dir .. escapeshellcmd() safe_mode_exec_dir .. escapeshellcmd() safe_mode_exec_dir .. escapeshellcmd() safe_mode_exec_dir .. escapeshellcmd() UID UID UID /UID UID /UID UID /UID copy() UID ( source target ) chgrp() chown() chmod() /UID /UID /UID SUID, SGID, /UID UID /UID symlink() UID (: ) /UID link() UID (: ) apache_request_headers() header() 'authorization'( ) WWW-Authenticate (HTTP) realm UID PHP_AUTH_USER, PHP_AUTH_PW, AUTH_TYPE $_SERVER USERREMOTE_USER PHP4.3.0

system()

passthru()

popen() fopen() mkdir() rmdir() rename()

unlink()

touch()

PHP_AUTH variables

169 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

PHP 4.3 PHP Command Line Interface CLI SAPI (Server Application Programming Interface) SAPI PHP () CLI

SAPI SAPI CLI CGI SAPI

CLI SAPI PHP 4.2.0 ./configure --enable-cli PHP 4.3.0 CLI SAPI --enable-cli --disable-cli PHP 4.3.0 PHP CLI/CGI make CGI CLI sapi/cgi/php sapi/cli/php php make install configure configure apxs SAPI --disable-cgi make install CLI {PREFIX}/bin/php CGI CGI make install make install-cli configure --disable-cgi : --enable-cli --enable-cgi configure --enable-cli make install {PREFIX}/bin/php CLI PHP 4.2.0 PHP 4.2.3 Windows CLI CGI php.exe php-cli.exe PHP 4.3.0 Windows CLI cli php.exe cli/php.exe PHP 5 CLI php.exe CGI php-cgi.exe PHP 5 php-win.exe CLI php-win DOS php-gtk --enable-cli-win32 configure : SAPI ? php -v php CGI CLI php_sapi_name() PHP_SAPI : Unix man PHP 4.3.2 man php

CLI SAPI SAPI CGI SAPI CGI SAPI HTTP CLI SAPI CLI CGI -q -C --no-chdir HTML php.ini CLI SAPI

170 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

php.ini

CLI SAPI FALSE

HTML FALSE print(), echo()

html_errors

implicit_flush

TRUE

output buffering PHP

max_execution_time 0 (unlimited) Web

CLI SAPI PHP $argc () $argv () PHP 4.3.0CLI SAPI PHP $argc $argv register_argc_argv TRUE CGI MODULE PHP register_globals register_globals $_SERVER $HTTP_SERVER_VARS $_SERVER['argv'] : php.ini () ( register_argc_argv) CLI

stdin stdin 1

stdout

stderr stderr php -r 'fwrite(STDERR, "stderrn");' PHP : PHP stdin

CLI SAPI ! CGI SAPI

CGI $ pwd /tmp

171 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

$ php-cgi -f another_directory/test.php /tmp/another_directory

PHP

CLI SAPI $ pwd /tmp $ php -f another_directory/test.php /tmp

PHP : CGI SAPI CLI SAPI -C PHP -h PHP Usage: php [options] [-f] [--] [args...]

php [options] -r [--] [args...]

php [options] [-B ] -R [-E ] [--] [args...]

php [options] [-B ] -F [-E ] [--] [args...]

php [options] -- [args...]

php [options] -a

-a

Run interactively

-c | Look for php.ini file in this directory

-n

No php.ini file will be used

-d foo[=bar]

Define INI entry foo with value 'bar'

-e

Generate extended information for debugger/profiler

-f

Parse and execute .

-h

This help

-i

PHP information

-l

Syntax check only (lint)

-m

Show compiled in modules

-r

Run PHP without using script tags

-B

Run PHP before processing input lines

-R

Run PHP for every input line

-F

Parse and execute for every input line

-E

Run PHP after processing all input lines

-H

Hide any passed arguments from external tools.

-s

Display colour syntax highlighted source.

-v

Version number

-w

Display source with stripped comments and whitespace.

-z

Load Zend extension .

args...

--ini

--rf

--rc

--re

--ri

Arguments passed to script. Use -- args when first argument starts with - or script is read from stdin Show configuration file names Show information about function . Show information about class . Show information about extension . Show configuration for extension .

CLI SAPI PHP 1 . PHP php my_script.php php -f my_script.php

(-f ) my_script.php PHP .php : -f -- 2 . PHP php -r 'print_r(get_defined_constants());'

172 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

: /! -r 3 . PHP (stdin) () PHP $ some_application | some_filter | php | sort -u >final_output.txt

PHP PHP PHP ( ) $argv 0 (PHP -r - ) 2

$argc ( ) $argv - - PHP -- PHP #PHP $ php -r 'var_dump($argv);' -h Usage: php [options] [-f] [args...] [...] # '-h' PHP $ php -r 'var_dump($argv);' -- -h array(2) {

[0]=>

string(1) "-"

[1]=>

string(2) "-h" }

PHP #!/usr/bin/php PHP / PHP (: chmod +x test) /Perl Example#1 PHP #!/usr/bin/php test $ chmod +x test $ ./test -h -- foo array(4) {

[0]=>

string(6) "./test"

[1]=>

string(2) "-h"

[2]=>

string(2) "--"

[3]=>

string(3) "foo" }

- PHP 4.3.3

173 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

PHP PHP Readline Windows : TAB PHP ~/.php_history -a --interactive : auto_prepend_file auto_append_file : PHP CLI php.ini INI (php.ini ) $ php -c /custom/directory/ my_script.php -c --php-ini $ php -c /custom/directory/custom-file.ini my_script.php

-n --no-php-ini

php.ini PHP 4.3.0 php.ini -d configuration_directive[=value]

(): #"1" $ php -d max_execution_time

-r '$foo = ini_get("max_execution_time"); var_dump($foo);' string(1) "1"

-d

--define

#"" php -d max_execution_time=

-r '$foo = ini_get("max_execution_time"); var_dump($foo);' string(0) "" #'=' $

php -d max_execution_time=20

-r '$foo = ini_get("max_execution_time"); var_dump($foo);' string(2) "20" $

php

-d max_execution_time=doesntmakesense

-r '$foo = ini_get("max_execution_time"); var_dump($foo);' string(15) "doesntmakesense"

-e

--profile-info

/ -f

-f

--file

: -- PHP PHP

-h -? phpinfo() PHP php -i --info -i HTML PHP No syntax errors detected in 0 -l --syntax-check Errors parsing 255 ()(fatal error) --help --usage 1

174 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

PHP Web PHP Unix PHP Windows .php php.exe PHP Unix Windows PHP Example#8 (script.php) #!/usr/bin/php PHP

:

--help, -help, -h, -?

PHP CLI HTTP PHP 2 $argc $argv 1 () 2 0 ($argv[0]) 1 --help, -help, -h -? Unix script.php echothis script.php -h Windows Example#9 PHP (script.bat) @C:phpphp.exe script.php %1 %2 %3 %4 script.php c:phpphp.exe php.exe script.bat echothis script.bat -h PHP Readline

.NET Apache Alternative PHP Cache (APC) Advanced PHP Debugger (APD) (array) Aspell() BBCode BCMath PHP (bcompiler) Bzip2 CCVS API [] /

175 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

Classkit ClibPDF [] COM .Net (Windows) (Crack) (ctype) CURL, Client URL Library Cybercash Credit Mutuel CyberMUT Cyrus IMAP DB++ dbm dBase DBM [] dbx IO (DIO) DOM DOM XML enchant Exif Expect FAM) Forms Data Format Fileinfo filePro Firebird/InterBase Firebird/Interbase (PDO_FIREBIRD) FriBiDi FrontBase FTP (funchand) GeoIP Gettext GMP gnupg Net_Gopher Haru PDF HTTP Hyperwave Hyperwave API i18n () IBM (PDO_IBM) IBM DB2Cloudscape Apache Derby iconv ID3 IIS (image) Imagick IMAPPOP3 NNTP Informix Informix (PDO_INFORMIX) Ingres II IRC Gateway PHP / Java JSON KADM5 LDAP libxml Lotus Notes

176 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

LZF (Mail) Mailparse (Math) MaxDB PHP MCAL Mcrypt MCVE (Monetra) Memcache Mhash Mimetype Flash Ming Misc mnoGoSearch Microsoft SQL Server Microsoft SQL Server Sybase (PDO_DBLIB) Mohawk Software mSQL (mbstring) muscat MySQL MySQL (PDO_MYSQL) MySQL mysqli Ncurses Newt NSAPI / Oracle Unified ODBC ODBC DB2 (PDO_ODBC) oggvorbis OpenAL OpenSSL Oracle [] Oracle (PDO_OCI) (output control) Ovrimos SQL Paradox Parsekit Perl PDF PDO Phar PHP (info) POSIX (regex) (POSIX) PostgreSQL PostgreSQL (PDO_PGSQL) PostScript Pspell qtdom Radius Rar GNU Readline GNU Recode RPM runkit SAM - Simple Asynchronous Messaging: Satellite CORBA []

177 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

SCA SDO SDO XML SDO IPC (semaphore) SESAM PostgreSQL (session) (shmop) SimpleXML SNMP SOAP Standard PHP Library (SPL) SQLite SQLite (PDO_SQLITE) Secure Shell2 Strings() Subversion Shockwave Flash Swish Sybase TCP TCP Wrappers Tidy Tokenizer Unicode URL (Variable Handling) Verisign Payflow Pro vpopmail W32api WDDX win32ps win32service xattr xdiff XML XML-RPC XMLReader XMLWriter XSL XSLT YAZ YP/NIS Zip zlib See also .

.NET PHP

dotnet_load

178 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

(No version information available, might be only in CVS) dotnet_load DOTNET

int dotnet_load ( string $assembly_name [, string $datatype_name [, int $codepage ]] ) PHP

4.1.0 codepage

ApacheApachePHP : PHP 4.3.2PATH_TRANSLATED Apache 2 SAPI Apache SCRIPT_FILENAME Apache 1 PATH_TRANSLATED PATH_INFO CGI Apache 2PATH_INFO httpd.conf AcceptPathInfo = On

PHPApache

Apache PHPphp.ini php.ini php_flag .htaccess Example#1 .htaccessPHP php_flag engine off Apache engine "1"

PHP_INI_ALL PHP 4.0.5 PHP_INI_ALL PHP 4.0.5 PHP_INI_ALL PHP 4.0.5 PHP_INI_ALL PHP 4.0.5

child_terminate "0" last_modified xbit_hack "0" "0"

PHP_INI_* php.ini

engine booleanPHP / ApachePHP PHP httpd.conf engineoff PHP

child_terminate boolean

179 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

PHP apache_child_terminate()

last_modified booleanPHPLast-Modified:

xbithack booleanPHP

apache_child_terminate(PHP 4 >= 4.0.5, PHP 5) apache_child_terminate Apache

bool apache_child_terminate ( void ) apache_child_terminate() PHP Apache

PHP Apache 1 TRUE Apache child_terminate PHP () FALSE E_WARNING

: Windows

exit()

apache_get_modules(PHP 4 >= 4.3.2, PHP 5) apache_get_modules Apache

array apache_get_modules ( void ) Apache

Apache array

180 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

5.0.0 Apache 1 Apache 2 API Apache 2

API

Example#1 apache_get_modules() Array (

[0] => core

[1] => http_core

[2] => mod_so

[3] => sapi_apache2

[4] => mod_mime

[5] => mod_rewrite )

apache_get_version(PHP 4 >= 4.3.2, PHP 5) apache_get_version Apache

string apache_get_version ( void ) Apache

Apache FALSE

4.3.4 5.0.0 Apache 1 Apache 2 API

Example#1 apache_get_version() Apache/1.3.29 (Unix) PHP/4.3.4

phpinfo()

apache_getenv(PHP 4 >= 4.3.0, PHP 5)

181 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

apache_getenv Apache subprocess_env

string apache_getenv ( string $variable [, bool $walk_to_top ] )

variable Apache Apache 2

variableApache

walk_to_top Apache

Apache FALSE

Example#1 apache_getenv() Apache SERVER_ADDR 42.24.42.240

apache_setenv() getenv()

apache_lookup_uri(PHP 4, PHP 5) apache_lookup_uri URI

object apache_lookup_uri ( string $filename ) URI PHP apache

filename (URI)

URI object status

182 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

the_request status_line method content_type handler uri filename path_info args boundary no_cache no_local_copy allowed send_bodyct bytes_sent byterange clength unparsed_uri mtime request_time

Example#1 apache_lookup_uri() stdClass Object (

[status] => 200

[the_request] => GET /dir/file.php HTTP/1.1

[method] => GET

[mtime] => 0

[clength] => 0

[chunked] => 0

[content_type] => application/x-httpd-php

[no_cache] => 0

[no_local_copy] => 1

[unparsed_uri] => /dir/index.php?var=value

[uri] => /dir/index.php

[filename] => /home/htdocs/dir/index.php

[args] => var=value

[allowed] => 0

[sent_bodyct] => 0

[bytes_sent] => 0

[request_time] => 1074282764 ) file exists!

apache_note(PHP 4, PHP 5) apache_note Apache(note)/

string apache_note ( string $note_name [, string $note_value ] ) apache_note()Apache notes

note_name

183 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

note_value

1 note_name 2note_name note_value note_name FALSE

apache_request_headers(PHP 4 >= 4.3.0, PHP 5) apache_request_headers HTTP

array apache_request_headers ( void ) HTTP PHP apache

HTTP FALSE

Example#1 apache_request_headers() Accept: */* Accept-Language: en-us Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 Host: www.example.com Connection: Keep-Alive

: PHP 4.3.0apache_request_headers() getallheaders()PHP 4.3.0 getallheaders() apache_request_headers() : CGI PHPApache phpinfo() : PHP 4.3.3 Netscape/iPlanet/SunONE Web NSAPI

apache_response_headers()

apache_reset_timeout(PHP 5 >= 5.1.0) apache_reset_timeout Apache

184 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

bool apache_reset_timeout ( void ) apache_reset_timeout() Apache 300 set_time_limit(0);

ignore_user_abort(true) apache_reset_timeout() Apache Apache 1

TRUE FALSE

: safe-mode

apache_response_headers(PHP 4 >= 4.3.0, PHP 5) apache_response_headers HTTP

array apache_response_headers ( void ) Apache

Apache FALSE

Example#1 apache_response_headers() Array (

[Accept-Ranges] => bytes

[X-Powered-By] => PHP/4.3.8 )

: PHP 4.3.3 Netscape/iPlanet/SunONE Web NSAPI

apache_request_headers() headers_sent()

apache_setenv(PHP 4 >= 4.2.0, PHP 5) apache_setenv Apache

bool apache_setenv ( string $variable , string $value [, bool $walk_to_top ] )

185 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

apache_setenv() variable Apache : Apache $_SERVER

variable

value variable walk_to_top Apache

TRUE FALSE

Example#1 apache_setenv() Apache

: apache_setenv() PHP Server Side Includes (.shtml) apache_getenv()

apache_getenv()

ascii2ebcdic(No version information available, might be only in CVS) ascii2ebcdic ASCIIEBCDIC

int ascii2ebcdic ( string $ascii_str ) ascii2ebcdic() EBCDIC (OS/390, BS2000)Apache ASCII ascii_str EBCDIC()

ascii_str ASCII

ASCII EBCDIC

ebcdic2ascii()

ebcdic2ascii

186 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

(No version information available, might be only in CVS) ebcdic2ascii EBCDICASCII

int ebcdic2ascii ( string $ebcdic_str ) ebcdic2ascii() EBCDIC (OS/390, BS2000)Apache EBCDIC ebcdic_str ASCII()

ebcdic_str EBCDIC

EBCDIC ASCII

ascii2ebcdic()

getallheaders(PHP 4, PHP 5) getallheaders HTTP

array getallheaders ( void ) HTTP apache_request_headers() HTTP apache_request_headers() PHP apache

HTTP FALSE

4.3.0 apache_request_headers() Apache

: PHP 4.3.3 Netscape/iPlanet/SunONE Web NSAPI

apache_response_headers()

virtual(PHP 4, PHP 5) virtual Apache

187 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

bool virtual ( string $filename ) virtual() mod_include Apache Apache CGI .shtml Apache CGI CGI Content-type PHP apache

filenamevirtual

virtual FALSE

4.0.6 require() PHP PHP include()

$_GET $_SERVER['QUERY_STRING'] Apache 2 Apache : : PHP 4.3.3 Netscape/iPlanet/SunONE Web NSAPI

apache_child_terminate Apache apache_get_modules Apache apache_get_version Apache apache_getenv Apache subprocess_env apache_lookup_uri URI apache_note Apache(note)/ apache_request_headers HTTP apache_reset_timeout Apache apache_response_headers HTTP apache_setenv Apache ascii2ebcdic ASCIIEBCDIC ebcdic2ascii EBCDICASCII getallheaders HTTP virtual Apache

Alternative PHP Cache (APC)Alternative PHP Cache (APC) PHP PHP

188 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

PECL PHP PECL PECL CHANGELOG http://pecl.php.net/package/apc. PECL DLL PHP http://pecl4win.php.net/ : Windows APC temp Web APC TMPTEMPUSERPROFILE WINDOWS : developer-supplied TECHNOTES file

php.ini APC 2 APC APC ini apc.shm_size apc.stat apc.php PHP GD Cache full count ( apc.ttl ) APC apc.filters

189 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

APC apc.enabled apc.shm_segments apc.shm_size apc.optimization apc.num_files_hint apc.user_entries_hint apc.ttl apc.user_ttl apc.gc_ttl apc.cache_by_default apc.filters apc.mmap_file_mask apc.slam_defense "1" "1" "30" "0" "1000" "4096" "0" "0" "3600" "1" NULL NULL "0" PHP_INI_SYSTEM PHP_INI_SYSTEM PHP_INI_SYSTEM PHP_INI_ALL PHP_INI_SYSTEM PHP_INI_SYSTEM APC 3.0.0 PHP_INI_SYSTEM APC 3.0.0 PHP_INI_SYSTEM APC 3.0.0 PHP_INI_SYSTEM PHP_INI_ALL PHP_INI_SYSTEM PHP_INI_SYSTEM PHP_INI_SYSTEM APC 3.0.0 PHP_INI_SYSTEM APC 3.0.6 PHP_INI_SYSTEM APC 3.0.7 PHP_INI_SYSTEM APC 3.0.7 PHP_INI_SYSTEM APC 3.0.10 PHP_INI_SYSTEM APC 3.0.11 PHP_INI_SYSTEM APC 3.0.11 PHP_INI_SYSTEM APC 3.0.12 PHP_INI_SYSTEM APC 3.0.13 PHP_INI_SYSTEM APC string(3) "BAR" string(3) "BAR"

apc_store()

193 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

apc_fetch() apc_delete()

apc_cache_info(PECL apc:2.0-3.0.9) apc_cache_info APC

array apc_cache_info ([ string $cache_type ] )

FALSE : APC apc_cache_info() APC

cache_type cache_type "user" ()

limited limited TRUE

3.0.11 limited

Example#1 apc_cache_info() Array (

[num_slots] => 2000

[ttl] => 0

[num_hits] => 9

[num_misses] => 3

[start_time] => 1123958803

[cache_list] => Array

(

[0] => Array

(

[filename] => /path/to/apc_test.php

[device] => 29954

[inode] => 1130511

[type] => file

[num_hits] => 1

[mtime] => 1123960686

[creation_time] => 1123960696

[deletion_time] => 0

[access_time] => 1123962864

[ref_count] => 1

[mem_size] => 677

)

[1] => Array (...iterates for each cached file) )

194 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

APC

apc_clear_cache(PECL apc:2.0-3.0.9) apc_clear_cache APC

bool apc_clear_cache ([ string $cache_type ] )

TRUE FALSE

cache_type cache_type "user" ()

apc_compile_file(PECL apc:3.0.13-3.0.14) apc_compile_file

bool apc_compile_file ( string $filename )

TRUE FALSE

filename PHP

apc_define_constants(PECL apc:3.0.0-3.0.9) apc_define_constants

bool apc_define_constants ( string $key , array $constants [, bool $case_sensitive ] ) define() APC / PECL hidef : constants

key

195 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

key key apc_load_constants() constants constant_name => value constant_name value

case_sensitive CONSTANT Constant FALSE

TRUE FALSE

Example#1 apc_define_constants() 123

apc_load_constants() define() constant() PHP

apc_delete(PECL apc:3.0.0-3.0.9) apc_delete

bool apc_delete ( string $key )

keyapc_store() key

TRUE FALSE

Example#1 apc_delete()

196 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

apc_store() apc_fetch()

apc_fetch(PECL apc:3.0.0-3.0.9) apc_fetch

mixed apc_fetch ( string $key )

keyapc_store() key

FALSE

Example#1 apc_fetch() string(3) "BAR"

apc_store() apc_delete()

apc_load_constants(PECL apc:3.0.0-3.0.9) apc_load_constants

bool apc_load_constants ( string $key [, bool $case_sensitive ] )

keyapc_define_constants()

case_sensitive CONSTANT Constant FALSE

197 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

TRUE FALSE

Example#1 apc_load_constants() 123

apc_define_constants() define() constant() PHP

apc_sma_info(PECL apc:2.0-3.0.9) apc_sma_info APC

array apc_sma_info ([ bool $limited ] )

limited

FALSE

Example#1 apc_sma_info() Array (

[num_seg] => 1

[seg_size] => 31457280

[avail_mem] => 31448408

[block_lists] => Array

(

[0] => Array

(

[0] => Array

(

[size] => 31448408

[offset] => 8864

)

) ) )

198 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

APC

apc_store(PECL apc:3.0.0-3.0.9) apc_store

bool apc_store ( string $key , mixed $var [, int $ttl ] ) : PHP apc_store()

keykey key

var

ttlvar ttl ttl ttl ttl 0 clear, restart

TRUE FALSE

Example#1 A apc_store() string(3) "BAR"

apc_add() apc_fetch() apc_delete()

apc_add () apc_cache_info APC apc_clear_cache APC apc_compile_file apc_define_constants

199 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

apc_delete apc_fetch apc_load_constants apc_sma_info APC apc_store

Advanced PHP Debugger (APD)APD PHP PHP APD APD Zend PHP Zend Zend Optimizer

APD PECL http://pecl.php.net/package/apd CGI PHP phpize APD pear install apd

APD Zend PHP extension zend_extension PHP Windows http://snaps.php.net/win32/PECL_STABLE/ php_apd.dll INI zend_extension = /absolute/path/to/apd.so apd.dumpdir = /absolute/path/to/trace/directory apd.statement_tracing = 0 PHP zend_extension zend_extension

zend_extension_ts

zend_extension_debug

zend_extension_debug_ts

( ZTS, debug ) (

ZTS, debug ) ( ZTS,

debug ) (

ZTS,

debug )

Win32 Windows APD http://php.net/ PHP -- Microsoft Visual C++ win32build.zipbison/flex adp.dsp DOS Unix Microsoft Visual C++

php.ini APD apd.dumpdir NULL PHP_INI_ALL PHP_INI_ALL apd 0.9

apd.statement_tracing "0"

PHP_INI_* php.ini

200 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

apd.dumpdir stringAPD apd_set_pprof_trace()

apd.statement_tracing boolean on (1)

PHP APD FUNCTION_TRACE (integer) ARGS_TRACE (integer) 1 2

ASSIGNMENT_TRACE (integer) 4 STATEMENT_TRACE (integer) 8 MEMORY_TRACE (integer) TIMING_TRACE (integer) SUMMARY_TRACE (integer) ERROR_TRACE (integer) PROF_TRACE (integer) APD_VERSION (string) 16 32 64 128 256 : 1.0.2-dev

PHP-APD 1 . PHP apd_set_pprof_trace() apd_set_pprof_trace(); 2 . apd.dumpdir/pprof_pid.ext CGI PHP apd '-e' php -e -f script.php 3 . pprofp bash-2.05b$ pprofp -R /tmp/pprof.22141.0 Trace for /home/dan/testapd.php Total Elapsed Time = 0.00 Total System Time

= 0.00 Total User Time

= 0.00 Real

User

System

secs/

cumm %Time (excl/cumm)

(excl/cumm)

(excl/cumm) Calls

call

s/call

Memory Usage Name -------------------------------------------------------------------------------------100.0 0.00 0.00

0.00 0.00

0.00 0.00

1

0.0000

0.0009

0 main 56.9 0.00 0.00

0.00 0.00

0.00 0.00

1

0.0005

0.0005

0 apd_set_pprof_trace 28.0 0.00 0.00

0.00 0.00

0.00 0.00

10

0.0000

0.0000

0 preg_replace 14.3 0.00 0.00

0.00 0.00

0.00 0.00

10

0.0000

0.0000

0 str_replace

-R "cumm call"

201 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

"s/call" 1 4. KCacheGrind pprof2calltree

[email protected]

apd_breakpoint(PECL apd:0.2-1.0.1) apd_breakpoint CR

bool apd_breakpoint ( int $debug_level ) Enter () PHP

debug_level XXX_TRACE MEMORY_TRACE ASSIGNMENT_TRACE (TIMING, FUNCTIONS, ARGS SUMMARY (strace -c )) 99

TRUE FALSE

Example#1 tcplisten bash#tcplisten localhost 7777 APD - Advanced PHP Debugger Trace File --------------------------------------------------------------------------Process Pid (6118) Trace Begun at Sun Mar 10 23:13:12 2002 --------------------------------------------------------------------------(

0.000000): apd_set_session_trace called at /home/alan/Projects/project2/test. php:5 (

0.074824): apd_set_session_trace_socket() at /home/alan/Projects/project2/tes t.php:5 returned.

Elapsed (0.074824) (

0.074918): apd_breakpoint() /home/alan/Projects/project2/test.php:7

++ argv[0] $(??) = 9 apd_breakpoint() at /home/alan/Projects/project2/test.php:7 returned.

Elapsed ( -2089521468.1073275368) >n statement: /home/alan/Projects/project2/test.php:8 >n statement: /home/alan/Projects/project2/test.php:8 >n statement: /home/alan/Projects/project2/test.php:10 >apd_echo($i); EXEC: apd_echo($i); 0 >apd_echo(serialize(apd_get_active_symbols())); EXEC:

apd_echo(serialize(apd_get_active_symbols())); a:47:{i:0;s:4:"PWD";i:1;s:10:"COLORFGBG";i:2;s:11:"XAUTHORITY";i:3;s:14:" COLORTERM_BCE";i:4;s:9:"WINDOWID";i:5;s:14:"ETERM_VERSION";i:6;s:16:"SE SSION_MANAGER";i:7;s:4:"PS1";i:8;s:11:"GDMSESSION";i:9;s:5:"USER";i:10;s:5:" MAIL";i:11;s:7:"OLDPWD";i:12;s:5:"LANG";i:13;s:10:"COLORTERM";i:14;s:8:"DISP LAY";i:15;s:8:"LOGNAME";i:16;s:6:" >apd_echo(system('ls /home/mydir')); ........ >apd_continue(0);

apd_callstack202 / 3658 07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

(PECL apd:0.2-0.4) apd_callstack

array apd_callstack ( void )

Example#1 apd_callstack()

apd_clunk(No version information available, might be only in CVS) apd_clunk

void apd_clunk ( string $warning [, string $delimiter ] ) perl Carp::cluck "
\n"

warning

delimiter

Example#1 apd_clunk()

apd_croak()

apd_continue(PECL apd:0.2-1.0.1) apd_continue

bool apd_continue ( int $debug_level )

203 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

debug_level XXX_TRACE MEMORY_TRACE ASSIGNMENT_TRACE (TIMING, FUNCTIONS, ARGS SUMMARY (strace -c )) 99

TRUE FALSE

Example#1 apd_continue()

apd_croak(PECL apd:0.2-0.4) apd_croak

void apd_croak ( string $warning [, string $delimiter ] ) perl Carp::croak

warning

delimiter

Example#1 apd_croak()

apd_clunk()

apd_dump_function_table(No version information available, might be only in CVS) apd_dump_function_table

204 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

void apd_dump_function_table ( void )

Example#1 apd_dump_function_table()

apd_dump_persistent_resources(PECL apd:0.2-0.4) apd_dump_persistent_resources

array apd_dump_persistent_resources ( void )

Example#1 apd_dump_persistent_resources()

apd_dump_regular()

apd_dump_regular_resources(PECL apd:0.2-0.4) apd_dump_regular_resources

array apd_dump_regular_resources ( void )

Example#1 apd_dump_regular_resources()

205 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

apd_dump_persistent_resources()

apd_echo(PECL apd:0.2-1.0.1) apd_echo

bool apd_echo ( string $output )

output

TRUE FALSE

Example#1 apd_echo()

apd_get_active_symbols(PECL apd:0.2) apd_get_active_symbols

array apd_get_active_symbols ( void ) ()

Example#1 apd_get_active_symbols()

apd_set_pprof_trace(PECL apd:0.2-1.0.1) apd_set_pprof_trace

206 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

string apd_set_pprof_trace ([ string $dump_directory [, string $fragment ]] ) pprof_{process_id}

dump_directory php.ini apd.dumpdir

fragment

Example#1 apd_set_pprof_trace()

apd_set_session_trace()

apd_set_session_trace(PECL apd:0.2-0.4) apd_set_session_trace

void apd_set_session_trace ( int $debug_level [, string $dump_directory ] ) apd_dump_{process_id}

debug_level XXX_TRACE MEMORY_TRACE ASSIGNMENT_TRACE (TIMING, FUNCTIONS, ARGS SUMMARY (strace -c )) 99

dump_directory php.ini apd.dumpdir

Example#1 apd_set_session_trace()

apd_set_session

207 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

(PECL apd:0.2-0.4) apd_set_session

void apd_set_session ( int $debug_level )

debug_level XXX_TRACE MEMORY_TRACE ASSIGNMENT_TRACE (TIMING, FUNCTIONS, ARGS SUMMARY (strace -c )) 99

Example#1 apd_set_session()

apd_set_socket_session_trace(No version information available, might be only in CVS) apd_set_socket_session_trace

bool apd_set_socket_session_trace ( string $tcp_server , int $socket_type , int $port , int $debug_level ) tcp_server (: tcplisten)

tcp_serverTCP IP Unix ()

socket_type AF_UNIX tcp/ip APD_AF_INET

port

debug_level XXX_TRACE MEMORY_TRACE ASSIGNMENT_TRACE (TIMING, FUNCTIONS, ARGS SUMMARY (strace -c )) 99

208 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

TRUE FALSE

Example#1 apd_set_socket_session_trace()

override_function(PECL apd:0.2-1.0.1) override_function

bool override_function ( string $function_name , string $function_args , string $function_code )

function_name

function_args function_code () $your_var

function_code

TRUE FALSE

Example#1 override_function() Array (

[FIRST] => 1

[SECOND] => 4 )

: (:"keY" "kEY")

array_chunk(PHP 4 >= 4.2.0, PHP 5) array_chunk

array array_chunk ( array $input , int $size [, bool $preserve_keys ] ) size size

input

size

preserve_keysTRUE FALSE

size

/ size 1 E_WARNING NULL

Example#1 array_chunk()

212 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

Array (

[0] => Array

(

[0]=>a

[1]=>b

)

[1] => Array

(

[0]=>c

[1]=>d

)

[2] => Array

(

[0]=>e

) ) Array (

[0] => Array

(

[0]=>a

[1]=>b

)

[1] => Array

(

[2]=>c

[3]=>d

)

[2] => Array

(

[4]=>e

) )

array_combine(PHP 5) array_combine

array array_combine ( array $keys , array $values )

keys values

keys

values

FALSE

/ keys values E_WARNING

Example#1 array_combine() Array (

[green]

=> avocado

[red]

=> apple

[yellow] => banana )

array_merge() array_walk() array_values()

array_count_values(PHP 4, PHP 5) array_count_values

array array_count_values ( array $input ) array_count_values() input input

input

input

/ string integer E_WARNING

Example#1 array_count_values() Array (

[1] => 2

[hello] => 2

[world] => 1 )

count() array_unique() array_values() count_chars()

214 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

array_diff_assoc(PHP 4 >= 4.3.0, PHP 5) array_diff_assoc

array array_diff_assoc ( array $array1 , array $array2 [, array $... ] )

array1 array2 array_diff()

array1

array2

...

array1

Example#1 array_diff_assoc() "a" => "green" 0 => "red" "red" 1 Array (

[b] => brown

[c] => blue

[0] => red )

Example#2 array_diff_assoc()

key => value (string) $elem1 === (string) $elem2 Array (

[0] => 0

[1] => 1

)

215 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

: N array_diff_assoc($array1[0], $array2[0]);

array_diff() array_intersect() array_intersect_assoc()

array_diff_key(PHP 5 >= 5.1.0) array_diff_key

array array_diff_key ( array $array1 , array $array2 [, array $... ] )

array1 array2 array_diff()

array1

array2

...

array1

Example#1 array_diff_key() key => value (string) $key1 === (string) $key2 array(2) {

["red"]=>

int(2)

["purple"]=>

int(4) }

: n array_diff_key($array1[0], $array2[0]);

array_diff()

216 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

array_udiff() array_diff_assoc() array_diff_uassoc() array_udiff_assoc() array_udiff_uassoc() array_diff_ukey() array_intersect() array_intersect_assoc() array_intersect_uassoc() array_intersect_key() array_intersect_ukey()

array_diff_uassoc(PHP 5) array_diff_uassoc

array array_diff_uassoc ( array $array1 , array $array2 [, array $... ], callback $key_compare_func )

array1 array2 array_diff() array_diff_assoc()

array1

array2

...

key_compare_func 1 2 / / / /

array1

Example#1 array_diff_uassoc()

"a" => "green" 0 => "red" 2 "red" 1

217 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.htmlArray (

[b] => brown

[c] => blue

[0] => red )

2

: n array_diff_uassoc($array1[0], $array2[0],

"key_compare_func");

array_diff() array_diff_assoc() array_udiff() array_udiff_assoc() array_udiff_uassoc() array_intersect() array_intersect_assoc() array_uintersect() array_uintersect_assoc() array_uintersect_uassoc()

array_diff_ukey(PHP 5 >= 5.1.0) array_diff_ukey

array array_diff_ukey ( array $array1 , array $array2 [, array $... ], callback $key_compare_func )

array1 array2 array_diff() array_diff_key()

array1

array2

...

key_compare_func 1 2 / / / /

array1

Example#1 array_diff_ukey()

218 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html array(2) {

["red"]=>

int(2)

["purple"]=>

int(4) }

: n array_diff_ukey($array1[0], $array2[0],

'callback_func');

array_diff() array_udiff() array_diff_assoc() array_diff_uassoc() array_udiff_assoc() array_udiff_uassoc() array_diff_key() array_intersect() array_intersect_assoc() array_intersect_uassoc() array_intersect_key() array_intersect_ukey()

array_diff(PHP 4 >= 4.0.1, PHP 5) array_diff

array array_diff ( array $array1 , array $array2 [, array $... ] )

array1 array2

Example#1 array_diff() $array1

219 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.htmlArray (

[1] => blue )

: (string) $elem1 === (string) $elem2 : n array_diff($array1[0], $array2[0]); PHP 4.0.4 !

array_diff_assoc() array_intersect() array_intersect_assoc()

array_fill_keys(PHP 5 >= 5.2.0) array_fill_keys

array array_fill_keys ( array $keys , mixed $value ) value keys

keys

value

Example#1 array_fill_keys() Array (

[foo] => banana

[5] => banana

[10] => banana

[bar] => banana )

220 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

array_fill() array_combine()

array_fill(PHP 4 >= 4.2.0, PHP 5) array_fill

array array_fill ( int $start_index , int $num , mixed $value ) value num start_index

start_index

num

value

/ num 1 E_WARNING

Example#1 array_fill() Array (

[5]

=> banana

[6]

=> banana

[7]

=> banana

[8]

=> banana

[9]

=> banana

[10] => banana )

str_repeat() range()

array_filter(PHP 4 >= 4.0.6, PHP 5) array_filter

221 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

array array_filter ( array $input [, callback $callback ] )

callback input callback true input input

input

callback input FALSE (boolean )

Example#1 array_filter() Odd : Array (

[a] => 1

[c] => 3

[e] => 5 ) Even: Array (

[0] => 6

[2] => 8

[4] => 10

[6] => 12 )

Example#2 callback array_filter() Array (

222 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

[0] => foo

[2] => -1 )

()

array_map() array_reduce() array_walk()

array_flip(PHP 4, PHP 5) array_flip

array array_flip ( array $trans ) array_flip() trans trans

trans integer string /

trans/

FALSE

Example#1 array_flip() Example#2 array_flip() :

$trans :Array (

[1] => b

[2] => c )

array_values()

223 / 3658

07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

array_keys() array_reverse()

array_intersect_assoc(PHP 4 >= 4.3.0, PHP 5) array_intersect_assoc

array array_intersect_assoc ( array $array1 , array $array2 [, array $... ] ) array_intersect_assoc() array1 array_intersect()

array1

array2

array

array1

Example#1 array_intersect_assoc() Array (

[a] => green )

"a" => "green" "red"

$array1 0 $array2 1 key => value (string) $elem1 === (string) $elem2

array_intersect() array_uintersect_assoc() array_intersect_uassoc() array_uintersect_uassoc() array_diff() array_diff_assoc()

array_intersect_key224 / 3658 07.12.11 0:51 AM

file:///Users/masahiro/Documents/cvs/phpdoc/bightml.html

(PHP 5 >= 5.1.0) array_intersect_key

array array_intersect_key ( array $array1 , array $array2 [, array $... ] ) array_intersect_key() array1

array1

array2

array

array1

Example#1 array_intersect_key() array(2) {

["blue"]=>

int(1)

["green"]=>

int(3) }

'blue' 'green' 'blue'

'green' array1 (string) $elem1 === (string) $elem2

array_diff() array_udiff() array_diff_assoc() array_diff_uassoc() array_udiff_assoc() array_udiff_uassoc() array_diff_key() array_diff_ukey() array_intersect() array_inters