PHP . C. , , . :
<?$t=time()>
, time(), t.
Abs .
BinDec , binary_string. , - 31 4294967295 . . DecBin().
ChDir , .
ChGrp .
ChMod , . perms .
Chr ASCII, .
CloseDir , openDir.
Cos , . . Sin() Tan()
Count . , 1 ( ). , 0.
Crypt , Unix - DES . , - - , . . Crypt Unix, . crypt , UFC-crypt , ; , , ftp .
Date . , , . , , , . time , Unix - 1 1970. , / . . , :
dbList db, PHP.
dbmClose dbm . , dbm .
dbmdelete /, key.
dbmFetch , .
dbmFirstKey dbm . , , -, dbm . Sort, dbm .
dbmInsert / dbm . , .
dbmNextKey , , . dbmfirstkey(), dbmnextkey() / dbm .
dbmOpen() dbm . dbm, , - , ; : "r", "n" "w" , ( ) . ndbm , ndbm filename.dir filename.pag. Gdbm , ascii , Berkeley libdb filename.db. , PHP , , dbm. PHP .lck, . , . dbm , Unix, GNU gdbm ftp://prep.ai.mit.edu/pub/gnu.
dbmReplace(filename,key,content) dbmReplace dbminsert(); , , .
DecBin , , , . , 31 4294967295 . . BinDec().
DecHex . . HexDec().
DecOct . . OctDec().
Echo . , . , PHP. , \n, \r \t , . Format_string , , . printf C . . printf . echo 5 . , . , . "" , , . - , , sprintf().
,
- %d %i
- .
- %o
- .
- %u
- .
- .
- %f
- .
- %e %E
- .
- %g %G
- .
- %c
- .
- %s
- .
- %%
- .
.
, printf C (''', , GNU).
- '-'
- .
- '+'
- , ( /).
- ' '
- '+', "" .
- '#'
- .
- '''
- ( ).
- '0'
- .
, demo_echo.html ( ) -, . , , .
<? Reset($array); $first_key = key($array); End($array); $k = key($array); while($k != $first_key); echo $array[$k]; prev($array); $k = key($array); endwhile; echo $array[$k]; >
EscapeShellCmd , -. , , , Exec() System(). :
<?system(EscapeShellCmd($cmd))>
Eval , , PHP/FI . PHP/FI. eval eval. , , . :
$a = "echo phpversion();"; eval($a); eval("echo phpversion();"); eval("\$a=1; echo \$a;");
Exec unix, . . , , - , PassThru(). , unix, [0]. return_var, unix. , , , , , EscapeShellCmd(), , . . System().
Exit , , .
Exp e, arg.
fclose() , fopen(). - , fopen().
Feof , , .
fgets() , fopen(). - , fopen() . , , . fgets() C. . fputs().
fgets(), , HTML PHP/FI, .
File , , , 0.
FileAtime . , , -1.
FileCtime . , - , -1.
FileGroup . , - , -1.
FileInode inode . , - , -1.
FileMtime . , - , -1
FileOwner . , - , -1.
FilePerms . - st_mode stat Unix. , - , -1.
fileSize . , - , -1.
Fopen() . , - , -1. C fopen(). filename - , , - , "r", "r+", "w", "w+", "a", "a+". . Unix fopen() . . popen(). . fclose().
:
$fp = fopen("/home/rasmus/file.txt","r");
Fsockopen() c . fgets, fputs fclose. - . : -3, , -4, hostname , -5 , , -, -6 fdopen() -7, setvbuf(). 0, hostname (File NameSpace), .
GetAccDir , PHP . , .
GetEnv , . , PHP/FI . , , . GetEnv , , PHP/FI. , , http-, REMOTE_ADDR REMOTE_HOST, , GetEnv , (. $REMOTE_ADDR), , -, , - , - .
GetHostByName IP nnn.nnn.nnn.nnn.
GetHostByAddr IP nnn.nnn.nnn.nnn .
, PHP
.
GetLastBrowser ,
,
.
, PHP
.
GetLastEmail
, .
, PHP
.
GetLastHost
.
, PHP
.
GetLastMod , unix,
.
Date() .
, PHP
.
GetLastRef URL,
.
, PHP
.
GetLogDir , PHP . . , . dbm, inode , .
GetMyInode inode HTML .
GetMyPid() php.
GetMyUid HTML .
GetRandMax , Rand. , , php.h PHP .
GetStartLogging , Unix, . mSQL, . dbm- .
GetToday
12 .
, PHP
.
GetTotal
, .
, PHP
.
GetType . , : "integer", "double" "string". . . SetType().
Date , , .
Header HTML , HTTP . . HTTP http.
HexDec . . DecHex().
HtmlSpecialChars c ascii 160 255 string HTML . .
ImageArc , cx, cy
( - 0,0) ,
im. W h
,
, s e.
, PHP GD .
ImageChar c ,
im x, y (
- 0,0) col. 1, 2, 3, 4 5
, . 1 , 5
.
, PHP GD.
ImageCharUp c , ,
im x, y (
- 0,0) col . 1, 2, 3, 4 5
, . 1 , 5
.
ImageColorAllocate ,
RGB . im -
ImageCreate.
ImageColorAllocate ,
, im.
, PHP GD.
ImageColorTransparent
im col. Im - ,
ImageCreate, col - ,
ImageColorAllocate.
, PHP GD.
ImageCopyResized
. Dst_im - ,
src_im - . ,
,
, .
.
( dst_im src_im)
, .
, PHP GD.
ImageCreate ,
x_size y_size.
, PHP GD.
ImageCreateFromGif ,
, filename.
, PHP GD.
ImageFilledPolygon
im. Points - PHP,
. . Points[0] = x0, points[1] = y0, points[2] =
x1, points[3] = y1, .. num_points - .
, PHP GD.
ImageFilledRectangle col
im, x1, y1
x2, y2. 0,0 -
.
, PHP GD.
, PHP GD.
ImageGif GIF, filenam
im. im -
ImageCreate. ,
,
. content-type image/gif,
Header(), PHP/FI,
GIF .
, PHP GD.
ImageInterlace , (interlace). interlace 1, im interlace, interlace - 0, . , PHP GD.
ImageLine x1, y1 x2, y2
( - 0,0) im
col.
, PHP GD.
ImagePolygon
im. points - PHP,
. . points[0] = x0, points[1] = y0, points[2] = x1,
points[3] = y1, .. Num_points - .
, PHP GD.
ImageString s ,
im, x, y (
- 0,0) col. size 1, 2, 3, 4 5,
, . 1 , 5
.
, PHP GD.
ImageStringUp s ,
im, x, y (
- 0,0) col. size 1, 2, 3, 4 5,
, . 1 , 5
.
, PHP GD.
ImageSX , im.
ImageSY , im.
Intval , long integer. . strval() doubleval().
IsSet 1, , 0, .
LinkInfo st_dev stat Unix, lstat . , , ( path), ( , S_ISLNK, stat.h). -1 .
.
Log10 10.
, .
MkDir . mode .
MkTime Unix (long integer) , , . , . . MkTime(hour, min, sec), MkTime(mon, day, year) .
Msql mSQL. - ,
. . <? Msql ("MyDatabase", "select * from
table") >. -
, ,
msql. -
. 0,
.
, , - ,
create, , drop, insert
delete. -1.
, $phperrmsg,
@msql()
.
, PHP mSQL .
Msql_Connect IP ,
mSQL .
msqlConnect() mSQL C API.
API - , , ,
msql(). ,
msql_close,
. msql_connect (),
.
msql , :
<? Msql_connect ("localhost") >
, PHP mSQL.
Msql_CreateDB .
, PHP mSQL .
Msql_dbName ,
$i ,
msql_ListDbs(). Msql_NumRows()
, ,
.
, PHP mSQL.
, PHP mSQL.
Msql_FieldFlags .
- "not null", "primery key",
"" ( ).
, PHP mSQL.
Msql_FieldLen .
, PHP mSQL.
Msql_FieldName .
- . .
Msql_FieldName($result, 2);
result.
, PHP mSQL.
Msql_FieldType msql_FieldName() .
, . "int",
"char" "real".
, PHP mSQL.
Msql_FreeResult ,
, .
. , ,
, msql_freeresult
, ,
.
, PHP mSQL.
msql_dbName(),
.
, PHP mSQL.
msql_listfields
tablename. - ,
. ,
msql_fieldflags, msql_fieldlen, msql_fieldname, msql_fieldtype.
- . -1,
. ,
$phperrmsg, @msql(), .
, PHP mSQL.
msql_ListTables
,
msql().
msql_TableName() ,
.
, PHP mSQL.
Msql_NumFields
result. - , msql().
, PHP mSQL.
Msql_NumRows
result. - ,
msql().
, PHP mSQL.
Msql_RegCase
, ,
mSQL, .
"abc" "[Aa][Bb][Cc]".
, PHP mSQL.
. "table.field" . :
<? $name = "bob"; $result = msql($database,"select * from table where firstname='$name'"); $num = msql_numrows($result); echo "$num records found!<p>"; $i=0; while($i < $num); echo msql_result($result,$i,"fullname"); echo "<br>"; echo msql_result($result,$i,"address"); echo "<br>"; $i++; endwhile; >
mSQL
, name bob
, ,
firstname bob.
,
fullname
address . ,
, HTML ,
. ,
connect(). Msql_connect
.
, PHP mSQL.
Msql_TableName , msql_ListTables(), . Msql_NumRows() . :
<? $result = msql_listtables("dbname"); $i=0; while($i < msql_numrows($result)); $tb_names[$i]=msql_tablename($result, $i); echo $tb_names[$i]; echo "<BR>"; $i++; endwhile; >
Next . , , - ($array []). . , , , . , .
<? Reset($array); $i=0; while($i < count($array)); echo key($array); next($array); $i++; endwhile; >
OctDec . . DecOct().
Ord ASCII .
Pclose popen().
Pg_Close Postgres95 ,
.
PHP Postgres95.
Pg_Connect
Postgres95. ,
. options tty
.
connection. Postgres95.
. 0
PHP Postgres95.
Pg_DBname Postgres95,
.
PHP Postgres95.
, , ,
, .
PHP Postgres95.
Pg_Exec SQL Postgres95,
connection_id. Connection_id
, pg_Connect. ,
, - , ,
Postgres95. 0
, 1 ,
( insert update).
, select, ,
1.
PHP Postgres95.
Pg_FieldName ,
Postgres95. ,
0.
PHP Postgres95.
Pg_FieldPrtLen , ,
( ) Postgres95.
0. -1
.
PHP Postgres95.
Pg_FieldNum ,
field_name Postgres95.
0. -1 .
PHP Postgres95.
Pg_FieldSize ( )
field_name Postgres95. 0
. -1
.
PHP Postgres95.
Pg_FieldType ,
Postgres95.
0.
PHP Postgres95.
Pg_FreeResult ,
.
. , ,
, pg_freeresult
,
.
PHP Postgres95.
Pg_GetLastOid ,
Oid, , ,
pg_Exec SQL insert.
, Oid, -1,
, ,
pg_Exec insert.
PHP Postgres95.
PHP Postgres95.
Pg_NumFields ()
Postgres95. - ,
pg_Exec. -1 .
PHP Postgres95.
Pg_NumRows
Postgres95. - , pg_Exec.
-1 .
PHP Postgres95.
Pg_Options , ,
Postgres95.
PHP Postgres95.
Pg_Port ,
Postgres95.
PHP Postgres95.
Pg_Result , pg_Exec. Row_number name_field , . 0. , , . 0.
Postgres95 . integer, boolean oid integer. float real double. , , Postgres95 'psql' 'monitor'.
PHP
Postgres95 .
Pg_tty , tty
Postgres95, .
PHP Postgres95.
PhpInfo , "?info" URL, PHP/FI php.cgi. , PHP/FI Apache, .
PhpVersion PHP/FI.
Popen . fgets, fputs fclose. - . "r" "w" . . popen UNIX C . , popen () , pclose().
PutEnv . , , PHP , , - PHP . , mSQL, PutEnv, .
QuoteMeta , arg, , , .
Rand 0 RANDMAX. RANDMAX getRandMax
ReadDir . , . openDir, .
ReadLink C readlink path -1 . . LinkInfo.
Reg_Match , . , , <?if (reg_match (" ^This. * ", "This is an example string")>, , "^This. *" , This . regs , match-, 0-10 , regs. 0 . , . , .
Reg_Replace , , . , , "This is an example string" : reg_replace(" ", "-", "This is an example string"). , . , .
Reg_Search . , , . , . regs , match , 0-10 , regs. 0 . , . , .
old new. C rename Unix.
<? Reset($array); $i=0; while($i < count($array)); echo $array[]; /* pointer automatically moves ahead one */ $i++; endwhile; >
RewindDir . openDir, .
SetCookie() cookie, . name . name, cookie name . ("") . expire secure - , . (0). expire - Unix, , - , time() mktime(). :
SetCookie("TestCookie","Test Value"); SetCookie("TestCookie",$value,time()+3600); /* expire in 1 hour */ SetCookie("TestCookie",$value,time()+3600,"/~rasmus/",".utoronto.ca",1);
, value cookie url , cookie, , cookie. . cookie , :
echo $TestCookie;
SetLogging() . arg , , .
SetShowInfo() , PHP. arg , , - .
SetType . type - , "integer", "double" "string". . GetType().
Sleep secs . C sleep() Unix. . USleep().
Sort , PHP . ; - , , . , , , .
Sprintf , , format arg. echo arg. , sprintf() . , . - "" , , .
Sqrt .
date, , . , ! rand(). .
<?srand(date("s")>
Strchr strstr - . . , , . , , "This is an example string" , : <echo strstr($string, "an ") > : "an example string".
Strlen .
Strrchr , string, . , , , .
Strstr strchr - . . string, , . , , "This is an example string" , : <? echo strstr ($string, "an")> : "an example string".
Strtok . "This is an example string" , . :
<? $string = "This is an example string"; $tok = strtok($string," "); while($tok); echo "Word=$tok<br>"; $tok = strtok(" "); endwhile; >
, strtok string. strtok , , . , , strtok string , .
Strtolower , string, .
Strval . . intval() doubleval().
Substr . start. - 0. length .
Symlink() . . Link(), .
System - C, unix . , unix . , , , System, EscapeShellCmd(), , . , , PassThru(). . Exec.
TempNam , , path , prefix. C tempnam() Unix.
Unlink filename. C unlink() Unix. . RmDir() .
"a-zA-Z0-9_-". %xx, xx - ASCII . .
USleep . C usleep() Unix . . Sleep().
Virtual - Apache - , <!-- #include virtual ... --> mod_include. - Apache. CGI .shtml , -, Apache ( .phtml , <?Include>.