PHP3 Manual
Stig Sæther Bakken Alexander Aulbach Egon Schmid
Jim Winstead Lars Torben Wilson
Rasmus Lerdorf Zeev Suraski
Edited by
Stig Sæther Bakken
PHP3 Manual
by Stig Sæther Bakken, Alexander Aulbach, Egon Schmid, Jim Winstead,
Lars Torben Wilson, Rasmus Lerdorf, and Zeev Suraski
Edited by Stig Sæther Bakken Published 1998-11-13
Copyright © 1997, 1998 by the PHP Documentation Group
Copyright
This manual is © Copyright 1997, 1998 the PHP Documentation Group. The
members of this group are listed on the front page of this manual.
This manual can be redistributed under the terms of the GNU General
Public License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
PHP 3.0 is copyright (C) 1997 the PHP Development Team. The members of
this team are listed in the CREDITS file that comes with the PHP 3.0
source distribution.
PHP 3.0 is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
PHP 3.0 is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Date: 1998-11-13
Release: 3.0.6
Preface i
About this Manual i
1. An introduction to PHP3 ............................................................................................................. |
1 |
What is PHP3? ....................................................................................................................... |
1 |
What can PHP3 do? ............................................................................................................... |
1 |
A Brief History of PHP.......................................................................................................... |
1 |
2. PHP3 features .............................................................................................................................. |
2 |
HTTP authentication with PHP.............................................................................................. |
2 |
GIF creation with PHP........................................................................................................... |
2 |
File upload support ................................................................................................................ |
3 |
HTTP cookie support............................................................................................................. |
4 |
Database support.................................................................................................................... |
4 |
Regular expressions ............................................................................................................... |
4 |
Error handling ........................................................................................................................ |
5 |
PHP source viewer................................................................................................................. |
5 |
3. Installation ................................................................................................................................... |
6 |
Installing From Source on UNIX........................................................................................... |
6 |
Downloading Source 6
Quick Installation Instructions (Apache Module Version)
6
Configuration 7
Apache module 7
fhttpd module 7
CGI version 7
Database Support Options 7
Adabas D 7
dBase 8
filePro 8
mSQL 8
MySQL 8
iODBC 8
OpenLink ODBC 9
Oracle 9
PostgreSQL 9
Solid 9
Sybase 9
Sybase-CT 10
Velocis 10
A custom ODBC library 10
Unified ODBC 10
LDAP 11
Other configure options 11
--with-xml 11
--enable-maintainer-mode 11
--with-system-regex 11
--with-config-file-path 11
--with-exec-dir 11
--disable-debug 12
--enable-safe-mode 12
--enable-track-vars 12
--enable-magic-quotes 12
--enable-debugger 12
--enable-discard-path 12
--enable-bcmath 13
--enable-force-cgi-redirect 13
--disable-short-tags 13
--enable-url-includes 13
--disable-syntax-hl 13
CPPFLAGS and LDFLAGS 14
Building 14
VPATH 14
Testing 14
Benchmarking 14
Installing PHP on Windows95/NT 14
Apache/NT and Stronghold/NT 14
IIS and MS-PWS 14
Problems? 15
Read the FAQ 15
Bug reports 15
Other problems 15
Security 15
- Configuration. 16
The php3.ini file 16
General Configuration Directives 16
Mail Configuration Directives 19
Safe Mode Configuration Directives
19
Debugger Configuration Directives
19
Extension Loading Directives 19
MySQL Configuration Directives 20
mSQL Configuration Directives 20
Postgres Configuration Directives
20
Sybase Configuration Directives 21
Sybase-CT Configuration Directives
21
BC Math Configuration Directives 21
Browser Capability Configuration Directives
21
Unified ODBC Configuration Directives
21
Apache Module 22
Apache module configuration directives 22
CGI redirection module/action module 22
CGI 22
Virtual hosts 22
Security 22
CGI binary 22
Possible attacks 22
Case 1: only public files served 23
Case 2: using --enable-force-cgi-redirect
23
Case 3: setting doc_root or user_dir
23
Case 4: PHP parser outside of web tree
24
Apache module 24
- Syntax and grammar 25
Escaping from HTML 25
Instruction separation 25
Variable types 25
Variable initialization 25
Initializing Arrays 25
Initializing objects 26
Variable Scope 26
Variable variables 27
Variables from outside PHP 28
HTML Forms (GET and POST). 28
IMAGE SUBMIT variable names 28
HTTP Cookies 28
Environment variables 29
Server configuration directives 29
Type juggling 29
Determining variable types 30
Type casting 30
String conversion 30
Array manipulation 31
- Language constructs 32
Expressions 32
IF 34
ELSE 35
ELSEIF 35
Alternative syntax for IF statements: IF(): ... ENDIF;.
35
WHILE 36
DO..WHILE 37
FOR. 37
SWITCH 38
REQUIRE 40
INCLUDE 40
FUNCTION 40
Returning values 41
Arguments 41
Passing by reference 41
Default values 42
OLD_FUNCTION 43
CLASS 43
- Expressions 45
Operators 45
Arithmetic Operators 45
String Operators 45
Assignment Operators 45
Bitwise Operators 46
Logical Operators 46
Comparison Operators 46
Precedence 47
-
Function Reference 48
- Adabas D Functions 49
ada_afetch 51
ada_autocommit 51
ada_close 51
ada_commit 51
ada_connect 52
ada_exec 52
ada_fetchrow 52
ada_fieldname 52
ada_fieldnum 53
ada_fieldtype 53
ada_freeresult 53
ada_numfields 53
ada_numrows 54
ada_result 54
ada_resultall 54
ada_rollback 54
- Apache Specific Functions 55
apache_lookup_uri 57
apache_note 58
getallheaders 58
virtual 59
- Array Functions 60
array 62
array_walk 62
arsort 63
asort. 64
count 64
current 65
each 65
end. 66
key 67
ksort 67
list 68
next 69
pos 69
prev 70
reset 70
rsort 70
sizeof 71
sort 71
uksort 72
uksort 72
usort 73
- [BC (Arbitrary Precision) Functions.
74](#bc-arbitrary-precision-functions)
bcadd 76
bccomp 76
bcdiv 76
bcmod 77
bcmul 77
bcpow 77
bcscale 78
bcsqrt. 78
bcsub 78
- Calendar Functions 79
JDToGregorian 81
GregorianToJD 81
JDToJulian 82
JulianToJD 82
JDToJewish 82
JewishToJD 83
JDToFrench 83
FrenchToJD 83
JDMonthName 84
JDDayOfWeek 85
- Date/Time Functions 86
checkdate 88
date 89
strftime 91
getdate 92
gmdate 93
mktime 93
gmmktime 94
time 94
microtime 94
- dBase Functions 95
dbase_create 97
dbase_open 98
dbase_close 98
dbase_pack 98
dbase_add_record 99
dbase_delete_record 99
dbase_get_record 99
dbase_numfields 100
dbase_numrecords 100
- dbm Functions 101
dbmopen 103
dbmclose 103
dbmexists 103
dbmfetch 104
dbminsert 104
dbmreplace 104
dbmdelete 105
dbmfirstkey 105
dbmnextkey 105
dblist 106
- Directory Functions 107
chdir 109
dir 109
closedir 110
opendir 110
readdir 110
rewinddir 111
- Dynamic Loading Functions 112
dl 114
- Program Execution Functions 115
escapeshellcmd 117
exec 117
system 118
passthru 118
- filePro Functions 119
filepro 121
filepro_fieldname 121
filepro_fieldtype 121
filepro_fieldwidth 122
filepro_retrieve 122
filepro_fieldcount 122
filepro_rowcount 123
- Filesystem Functions 124
basename 126
chgrp 126
chmod 127
chown 127
clearstatcache 128
copy 128
dirname 129
fclose 129
feof 130
fgetc 130
fgets 131
fgetss 131
file 131
file_exists 132
fileatime 132
filectime 132
filegroup 133
fileinode 133
filemtime 133
fileowner 134
fileperms 134
filesize 134
filetype 135
fopen 136
fpassthru 137
fputs 137
fread 137
fseek 138
ftell 138
fwrite 139
is_dir 139
is_executable 139
is_file 140
is_link 140
is_readable 140
is_writeable 141
link 141
linkinfo 141
mkdir 142
pclose 142
popen 143
readfile 143
readlink 144
rename 144
rewind 144
rmdir 145
stat 145
lstat 146
symlink 146
tempnam 147
touch 147
umask 147
unlink 148
- Functions related to HTTP 149
header 151
setcookie 152
- Hyperwave functions 153
hw_Changeobject 158
hw_Children. 158
hw_ChildrenObj 159
hw_Close 159
hw_Connect 159
hw_Cp 160
hw_Deleteobject 160
hw_DocByAnchor 160
hw_DocByAnchorObj 161
hw_DocumentAttributes 161
hw_DocumentBodyTag 161
hw_DocumentSize 162
hw_ErrorMsg 162
hw_EditText. 162
hw_Error 163
hw_Free_Document 163
hw_GetParents 163
hw_GetParentsObj 164
hw_GetChildColl 164
hw_GetChildCollObj 164
hw_GetSrcByDestObj 165
hw_GetObject 165
hw_GetAndLock 165
hw_GetText 166
hw_GetObjectByQuery. 166
hw_GetObjectByQueryObj 167
hw_GetObjectByQueryColl 167
hw_GetObjectByQueryCollObj 167
hw_GetChildDocColl 168
hw_GetChildDocCollObj 168
hw_GetAnchors 168
hw_GetAnchorsObj 169
hw_Mv 169
hw_Identify 169
hw_InCollections 170
hw_Info 170
hw_InsColl 170
hw_InsDoc 171
hw_InsertDocument 171
hw_New_Document 172
hw_Objrec2Array 172
hw_OutputDocument 172
hw_pConnect 173
hw_PipeDocument 173
hw_Root 173
hw_Unlock 174
hw_Username 174
- Image functions 175
GetImageSize 177
ImageArc 178
ImageChar 178
ImageCharUp 178
ImageColorAllocate 179
ImageColorTransparent 179
ImageCopyResized 179
ImageCreate 180
ImageCreateFromGif 180
ImageDashedLine 180
ImageDestroy 181
ImageFill 181
ImageFilledPolygon 181
ImageFilledRectangle 182
ImageFillToBorder 182
ImageFontHeight 182
ImageFontWidth 183
ImageGif 183
ImageInterlace 183
ImageLine 184
ImageLoadFont 184
ImagePolygon 185
ImageRectangle. 185
ImageSetPixel 185
ImageString 186
ImageStringUp 186
ImageSX 186
ImageSY 187
ImageTTFBBox 187
ImageTTFText 189
ImageColorAt 190
ImageColorClosest 190
ImageColorExact 190
ImageColorResolve. 191
ImageColorSet 191
ImageColorsForIndex 191
ImageColorsTotal 192
- IMAP Functions 193
imap_append 195
imap_base64 195
imap_body 195
imap_check 196
imap_close 196
imap_createmailbox 196
imap_delete 197
imap_deletemailbox 197
imap_expunge 197
imap_fetchbody 198
imap_fetchstructure. 198
imap_header 199
imap_headers 200
imap_listmailbox 200
imap_listsubscribed. 201
imap_mail_copy 201
imap_mail_move 201
imap_num_msg 202
imap_num_recent 202
imap_open 203
imap_ping 203
imap_renamemailbox 204
imap_reopen 204
imap_subscribe 204
imap_undelete 205
imap_unsubscribe 205
imap_qprint 205
imap_8bit 206
imap_binary 206
imap_scanmailbox 206
imap_mailboxmsginfo 207
imap_rfc822_write_address 207
imap_rfc822_parse_adrlist 208
imap_setflag_full 208
imap_clearflag_full 208
imap_sort 209
imap_fetchheader 209
imap_uid 210
- PHP options & information 211
error_log 213
error_reporting 214
getenv 214
get_cfg_var 215
get_current_user 215
getlastmod 215
getmyinode. 216
getmypid 216
getmyuid 216
phpinfo 217
phpversion 217
putenv 218
set_time_limit 218
- Informix Functions 219
ifx_connect 222
ifx_pconnect 223
ifx_close 223
ifx_query 224
ifx_prepare 226
ifx_do 227
ifx_error 228
ifx_errormsg 228
ifx_affected_rows 229
ifx_fetch_row 230
ifx_htmltbl_result 231
ifx_fieldtypes 232
ifx_fieldproperties 232
ifx_num_fields 233
ifx_num_rows 233
ifx_free_result 233
ifx_create_char 234
ifx_free_char 234
ifx_update_char 234
ifx_get_char 235
ifx_create_blob 235
ifx_copy_blob 235
ifx_free_blob 236
ifx_get_blob 236
ifx_update_blob 236
ifx_blobinfile_mode 237
ifx_textasvarchar 237
ifx_byteasvarchar 237
ifx_nullformat 238
ifxus_create_slob 238
ifx_free_slob 238
ifxus_close_slob 239
ifxus_open_slob 239
ifxus_tell_slob 239
ifxus_seek_slob 240
ifxus_read_slob 240
ifxus_write_slob 240
- InterBase Functions 241
ibase_connect 243
ibase_pconnect 243
ibase_close 243
ibase_query 243
ibase_fetch_row 244
ibase_free_result 244
ibase_prepare 244
ibase_bind 244
ibase_execute 245
ibase_free_query 245
ibase_timefmt 245
- LDAP Functions 246
ldap_add 250
ldap_bind 251
ldap_close 251
ldap_connect 251
ldap_count_entries 252
ldap_delete 252
ldap_dn2ufn 252
ldap_explode_dn 253
ldap_first_attribute 253
ldap_first_entry 254
ldap_free_result 254
ldap_get_attributes 255
ldap_get_dn 255
ldap_get_entries 256
ldap_get_values 257
ldap_list 257
ldap_modify 258
ldap_next_attribute 258
ldap_next_entry 259
ldap_read. 259
ldap_search 260
ldap_unbind 260
- Mail Functions 261
mail 263
- Mathematical Functions 264
Abs 266
Acos 266
Asin 266
Atan 267
Atan2 267
base_convert 267
BinDec 268
Ceil 268
Cos 268
DecBin 269
DecHex 269
DecOct 269
Exp 270
Floor 270
getrandmax. 270
HexDec 271
Log 271
Log10 271
max 272
min 272
number_format 273
OctDec 273
pi 274
pow 274
rand 274
round 275
Sin 275
Sqrt 275
srand 276
Tan 276
- Miscellaneous Functions 277
eval 279
exit 279
iptcparse 280
leak 280
register_shutdown_function 280
serialize 281
sleep 281
unserialize 282
uniqid 282
usleep 283
- mSQL Functions 284
msql 286
msql_close 286
msql_connect 287
msql_create_db 287
msql_createdb 287
msql_data_seek 288
msql_dbname 288
msql_drop_db 288
msql_dropdb 289
msql_error 289
msql_fetch_array 289
msql_fetch_field 290
msql_fetch_object 290
msql_fetch_row 291
msql_fieldname 291
msql_field_seek 291
msql_fieldtable 292
msql_fieldtype 292
msql_fieldflags 292
msql_fieldlen 293
msql_free_result 293
msql_freeresult 293
msql_list_fields 294
msql_listfields 294
msql_list_dbs 294
msql_listdbs 295
msql_list_tables 295
msql_listtables 295
msql_num_fields 295
msql_num_rows 296
msql_numfields 296
msql_numrows 296
msql_pconnect 297
msql_query 297
msql_regcase 297
msql_result 298
msql_select_db 298
msql_selectdb 299
msql_tablename 299
- MySQL Functions 300
mysql_affected_rows 302
mysql_close 302
mysql_connect 303
mysql_create_db 303
mysql_data_seek 304
mysql_dbname 304
mysql_db_query. 304
mysql_drop_db 305
mysql_errno 305
mysql_error 306
mysql_fetch_array 306
mysql_fetch_field 307
mysql_fetch_lengths 308
mysql_fetch_object 308
mysql_fetch_row 309
mysql_field_name 309
mysql_field_seek 310
mysql_field_table 310
mysql_field_type. 310
mysql_field_flags 311
mysql_field_len 311
mysql_free_result 312
mysql_insert_id 312
mysql_list_fields 312
mysql_list_dbs 313
mysql_list_tables 313
mysql_num_fields 313
mysql_num_rows 314
mysql_pconnect 314
mysql_query 315
mysql_result 315
mysql_select_db 316
mysql_tablename 316
- Sybase Functions 317
sybase_affected_rows 319
sybase_close 319
sybase_connect 320
sybase_data_seek 320
sybase_fetch_array 321
sybase_fetch_field. 321
sybase_fetch_object 322
sybase_fetch_row 322
sybase_field_seek 323
sybase_free_result 323
sybase_num_fields 323
sybase_num_rows 324
sybase_pconnect 324
sybase_query 325
sybase_result 325
sybase_select_db 326
- Network Functions 327
fsockopen 329
set_socket_blocking 330
gethostbyaddr 330
gethostbyname 330
gethostbynamel 331
checkdnsrr 331
getmxrr 332
openlog 332
syslog 332
closelog 333
debugger_on. 333
debugger_off 333
- ODBC Functions 334
odbc_autocommit 336
odbc_binmode 337
odbc_close 338
odbc_close_all 338
odbc_commit 338
odbc_connect 339
odbc_cursor 339
odbc_do. 339
odbc_exec 340
odbc_execute 340
odbc_fetch_into 340
odbc_fetch_row 341
odbc_field_name 341
odbc_field_num 341
odbc_field_type 342
odbc_free_result 342
odbc_longreadlen 342
odbc_num_fields 343
odbc_pconnect 343
odbc_prepare 343
odbc_num_rows 344
odbc_result 344
odbc_result_all 344
odbc_rollback 345
- Oracle functions 346
Ora_Bind 348
Ora_Close 348
Ora_ColumnName 349
Ora_ColumnType 349
Ora_Commit 350
Ora_CommitOff 350
Ora_CommitOn 350
Ora_Error 351
Ora_ErrorCode. 351
Ora_Exec 351
Ora_Fetch 352
Ora_GetColumn 352
Ora_Logoff 352
Ora_Logon 353
Ora_Open 353
Ora_Parse 354
Ora_Rollback 354
- PDF functions 355
PDF_get_info 357
PDF_set_info_creator 357
PDF_set_info_title 358
PDF_set_info_subject 358
PDF_set_info_keywords 359
PDF_set_info_author 359
PDF_open 360
PDF_close 360
PDF_begin_page 360
PDF_end_page 361
PDF_show 361
PDF_show 361
PDF_set_font 362
PDF_set_leading 362
PDF_set_text_rendering 362
PDF_set_horiz_scaling 363
PDF_set_text_rise 363
PDF_set_text_matrix 363
PDF_set_text_pos 364
PDF_set_char_spacing 364
PDF_set_word_spacing 364
PDF_continue_text 365
PDF_stringwidth 365
PDF_save 365
PDF_restore 366
PDF_translate 366
PDF_scale 366
PDF_rotate 367
PDF_setflat 367
PDF_setlinejoin 367
PDF_setlinecap 368
PDF_setmiterlimit 368
PDF_setlinewidth 368
PDF_setdash 369
PDF_moveto 369
PDF_curveto 369
PDF_lineto 370
PDF_circle 370
PDF_arc 370
PDF_rect 371
PDF_closepath 371
PDF_stroke 371
PDF_closepath_stroke 372
PDF_fill 372
PDF_fill_stroke 372
PDF_closepath_fill_stroke 373
PDF_endpath 373
PDF_clip 373
PDF_setgray_fill 374
PDF_setgray_stroke 374
PDF_setgray 374
PDF_setrgbcolor_fill. 375
PDF_setrgbcolor_stroke 375
PDF_setrgbcolor 375
PDF_add_outline 376
PDF_set_transition 376
PDF_set_duration 376
- PostgreSQL functions 377
pg_Close 380
pg_cmdTuples 380
pg_Connect 381
pg_DBname 381
pg_ErrorMessage 382
pg_Exec 382
pg_Fetch_Array 383
pg_Fetch_Object 384
pg_Fetch_Row 385
pg_FieldIsNull 386
pg_FieldName 386
pg_FieldNum 386
pg_FieldPrtLen 387
pg_FieldSize 387
pg_FieldType 387
pg_FreeResult 388
pg_GetLastOid 388
pg_Host 388
pg_loclose 389
pg_locreate 389
pg_loopen 389
pg_loread 390
pg_loreadall 390
pg_lounlink 390
pg_lowrite 391
pg_NumFields 391
pg_NumRows 391
pg_Options 392
pg_pConnect 392
pg_Port 392
pg_Result 393
pg_tty 393
- Regular expression functions 394
ereg 396
ereg_replace 397
eregi 397
eregi_replace 398
split 398
sql_regcase 399
- Solid Functions 400
solid_close 402
solid_connect 402
solid_exec 402
solid_fetchrow 402
solid_fieldname 403
solid_fieldnum 403
solid_freeresult 403
solid_numfields 403
solid_numrows 404
solid_result 404
- SNMP Functions 405
snmpget 407
snmpwalk 407
- String functions 408
AddSlashes 410
Chop 410
Chr 410
convert_cyr_string 411
crypt 412
echo 412
explode 413
flush 413
htmlspecialchars 414
htmlentities. 414
implode 415
join 415
ltrim 415
md5 416
nl2br 416
Ord 416
parse_str 417
print 417
printf 417
quoted_printable_decode 418
QuoteMeta 418
rawurldecode 419
rawurlencode 419
setlocale 420
soundex 421
sprintf 422
strchr 423
strcmp 423
strcspn 424
StripSlashes 424
strlen 424
strrpos 425
strpos 425
strrchr 426
strrev 426
strcspn 427
strstr 427
strtok 427
strtolower 428
strtoupper 428
strtr 429
substr 429
trim 430
ucfirst 430
ucwords 431
- URL functions 432
parse_url 434
urldecode 434
urlencode 435
base64_encode 435
base64_decode 436
- Variable functions 437
gettype 439
intval 439
doubleval 440
empty 440
strval 440
is_array 441
is_double 441
is_float 441
is_int 442
is_integer 442
is_long 442
is_object 443
is_real 443
is_string 443
isset 444
settype 444
- Gz-file Functions 445
gzclose 447
gzeof 447
gzfile 447
gzgetc 448
gzgets 448
gzgetss 448
gzopen 449
gzpassthru 449
gzputs 450
gzread 450
gzrewind 451
gzseek 451
gztell 452
readgzfile 452
gzwrite 453
XL. XML Parser Functions 454
xml_parser_create 464
xml_set_element_handler 465
xml_set_character_data_handler
466
xml_set_processing_instruction_handler
467
xml_set_default_handler 468
xml_set_unparsed_entity_decl_handler
469
xml_set_notation_decl_handler 470
xml_set_external_entity_ref_handler
471
xml_parse 472
xml_get_error_code 472
xml_error_string 473
xml_get_current_line_number 474
xml_get_current_column_number 474
xml_get_current_byte_index 474
xml_parser_free 474
xml_parser_set_option 475
xml_parser_get_option 476
utf8_decode 476
utf8_encode 477
- Appendixes 478
0. Migrating from PHP/FI 2.0 to PHP 3.0 479
About the incompatbilities in 3.0
479
Start/end tags 479
if..endif syntax 480
while syntax 480
Expression types 481
Error messages have changed 481
Short-circuited boolean evaluation
481
Function true/false return values
482
Other incompatibilities 482
0. PHP development 484
Adding functions to PHP3 484
Function Prototype 484
Function Arguments 484
Variable Function Arguments 484
Using the Function Arguments 485
Memory Management in Functions 486
Setting Variables in the Symbol Table
486
Returning simple values 488
Returning complex values 489
Using the resource list 490
Using the persistent resource table
491
Adding runtime configuration directives
492
Calling User Functions 492
HashTable *function_table 493
pval *object 493
pval *function_name 493
pval *retval 493
int param_count 493
pval *params[] 493
Reporting Errors 493
E_NOTICE 494
E_WARNING 494
E_ERROR 494
E_PARSE 494
E_CORE_ERROR. 494
E_CORE_WARNING 494
Hitchhiker's guide to PHP internals 494
- The PHP Debugger 495
Using the Debugger 495
Debugger Protocol 495
7-1. Arithmetic Operators 45
7-2. Bitwise Operators 46
7-3. Logical Operators 46
7-4. Comparson Operators 46
- Calendar modes 84
1. Calendar week modes 85
1. Font file format 184
1. error_log log types 213
1. error_reporting bit values 214
1. LONGVARBINARY handling 337
1. XML parser options 475
1. UTF-8 encoding 477
0-1. PHP Internal Types 485
0-2. Debugger Error Types 496
2-1. HTTP Authentication example 2
2-2. GIF creation with PHP 3
2-3. File Upload Form. 3
2-4. Regular expression examples 4
5-1. Ways of escaping from HTML 25
5-2. SetCookie Example 29
1. GetAllHeaders() Example 58
1. array example 62
1. array_walk example 62
1. arsort example 63
1. asort example 64
-
each() examples 65
-
Traversing $HTTP_POST_VARS with each() 66
1. ksort example 67
1. list example 68
1. rsort example 70
1. sort example 71
1. uksort example 72
1. usort example 73
1. Calendar functions 81
-
date example 89
-
date and mktime example 90
1. strftime example 92
1. gmdate example 93
1. mktime example 93
1. Creating a dBase database file 97
1. Using dbase_numfields 100
1. Visiting every key/value pair in a dbm database. 105
1. Dir() Example 109
1. basename example 126
1. copy example 128
1. dirname example 129
1. fopen() example 136
1. tempnam() example. 147
1. SetCookie examples 152
-
GetImageSize 177
-
GetImageSize returning IPTC 177
1. ImageTTFText 189
1. error_log examples 213
1. getlastmod() example 215
1. phpversion() example 217
1. Setting an Environment Variable 218
1. Connect to a Informix database. 222
1. Closing a Informix connection 223
-
Show all rows of the "orders" table as a html table 224
-
Insert some values into the "catalog" table 225
1. Informix affected rows 229
1. Informix fetch rows 230
1. Informix results as HTML table 231
1. Fielnames and SQL fieldtypes 232
1. Informix SQL fieldproperties 232
1. Complete example with authenticated bind 250
-
Sending mail. 263
-
Sending mail with extra headers 263
1. base_convert() 267
1. eval() example - simple text merge 279
1. serialize example 281
1. unserialize example 282
1. msql_tablename() example 299
1. mysql fetch array. 306
1. mysql field types 310
1. mysql_tablename() example 316
1. fsockopen example 329
1. PDF_get_info 357
1. PDF_get_info 366
1. pg_cmdtuples 380
1. PostgreSQL fetch array 383
1. Postgres fetch object 384
1. Postgres fetch row 385
1. ereg() example 396
1. ereg_replace() example 397
1. split() example 398
1. sql_regcase() example 399
1. chop() example 410
1. chr() example 410
1. explode() example 413
1. implode() example 415
1. ord() example 416
1. Using parse_str 417
-
rawurlencode() example 1 419
-
rawurlencode() example 2 419
1. Soundex Examples 421
1. sprintf: zero-padded integers 423
1. strrchr() example 426
1. strtok() example 427
1. strtr() example 429
1. urldecode() example 434
1. urlencode() example 435
- gzopen() example 449
0-1. Migration: old start/end tags 479
0-2. Migration: first new start/end tags 479
0-3. Migration: second new start/end tags 479
0-4. Migration: third new start/end tags 480
0-5. Migration: old if..endif syntax 480
0-6. Migration: new if..endif syntax 480
0-7. Migration: old while..endwhile syntax 480
0-8. Migration: new while..endwhile syntax 480
0-9. Migration from 2.0: return values, old code 482
0-10. Migration from 2.0: return values, new code 482
0-11. Migration from 2.0: concatenation for strings 482
0-1. Fetching function arguments 484
0-2. Variable function arguments 485
0-3. Checking whether $foo exists in a symbol table. 486
0-4. Finding a variable's size in a symbol table. 486
0-5. Initializing a new array 487
0-6. Adding entries to a new array 487
0-7. Adding a new resource 490
0-8. Using an existing resource 490
0-9. Deleting an existing resource 490
0-1. Example Debugger Message 497
Preface
PHP Version 3.0 is an HTML-embedded scripting language. Much of its
syntax is borrowed from C, Java and Perl with a couple of unique
PHP-specific features thrown in. The goal of the language is to allow
web developers to write dynamically generated pages quickly.
About this Manual
This manual is written in SGML using the DocBook DTD, using DSSSL
(Document Style and Semantics Specification Language) for formatting.
The tools used for formatting HTML, TeX and RTF versions are Jade,
written by James Clark and The Modular DocBook Stylesheets written by
Norman Walsh. PHP3's documentation framework was assembled by Stig
Sæther Bakken.