(sergeiesenin.lit-info.ru)

PHP . C. , , . :

 

	<?$t=time()>

, time(), t.

Abs(arg)

Abs .

BinDec(binary_string)

BinDec , binary_string. , - 31 4294967295 . . DecBin().

ChDir(dir)

ChDir , .

ChGrp(file,group)

ChGrp .

ChMod(file,perms)

ChMod , . perms .

ChOwn(file,owner)

Chr(arg)

Chr ASCII, .

closeDir()

CloseDir , openDir.

Cos(arg)

Cos , . . Sin() Tan()

Count(array)

Count . , 1 ( ). , 0.

Crypt(string,[salt])

Crypt , Unix - DES . , - - , . . Crypt Unix, . crypt , UFC-crypt , ; , , ftp .

Date(format,time)

Date . , , . , , , . time , Unix - 1 1970. , / . . , :

 

dbList()

dbList db, PHP.

dbmClose(filename)

dbmClose dbm . , dbm .

dbmDelete(filename,key)

dbmdelete /, key.

dbmFetch(filename,key)

dbmFetch , .

dbmFirstKey(filename)

dbmFirstKey dbm . , , -, dbm . Sort, dbm .

dbmInsert(filename,key,content)

dbmInsert / dbm . , .

dbmNextKey , , . dbmfirstkey(), dbmnextkey() / dbm .

dbmOpen(filename,mode)

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(number)

DecHex . . HexDec().

DecOct(number)

DecOct . . OctDec().

doubleval(variable) Doubleval double ( ) . . strval() intval().
Echo [format_string] expression [, expression [,...]]

Echo . , . , PHP. , \n, \r \t , . Format_string , , . printf C . . printf . echo 5 . , . , . "" , , . - , , sprintf().

,

 

%d %i
.
%o
.
%u
.
.
%f
.
%e %E
.
%g %G
.
%c
.
%s
.
%%
.

.

'-'
.
'+'
, ( /).
' '
'+', "" .
'#'
.
'''
( ).
'0'
.
, printf C (''', , GNU).

, demo_echo.html ( ) -, . , , .

End(variable)

End . . . Reset() Prev(). :

 

	<?
	  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(string)

EscapeShellCmd , -. , , , Exec() System(). :

 

	<?system(EscapeShellCmd($cmd))>
Eval(string)

Eval , , PHP/FI . PHP/FI. eval eval. , , . :

 

	$a = "echo phpversion();";
	eval($a);

	eval("echo phpversion();");

	eval("\$a=1; echo \$a;");
Exec(command_string [, array [,return_var]])

Exec unix, . . , , - , PassThru(). , unix, [0]. return_var, unix. , , , , , EscapeShellCmd(), , . . System().

Exit

Exit , , .

Exp(arg)

Exp e, arg.

fclose() , fopen(). - , fopen().

feof($fd)

Feof , , .

fgets($fd,bytes)

fgets() , fopen(). - , fopen() . , , . fgets() C. . fputs().

fgetss($fd,bytes)

fgets(), , HTML PHP/FI, .

$array = File(filename)

File , , , 0.

fileAtime(filename)

FileAtime . , , -1.

fileCtime(filename)

FileCtime . , - , -1.

fileGroup(filename)

FileGroup . , - , -1.

fileInode(filename)

FileInode inode . , - , -1.

FileMtime . , - , -1

fileOwner(filename)

FileOwner . , - , -1.

filePerms(filename)

FilePerms . - st_mode stat Unix. , - , -1.

fileSize(filename)

fileSize . , - , -1.

$fp = fopen(filename,mode)

Fopen() . , - , -1. C fopen(). filename - , , - , "r", "r+", "w", "w+", "a", "a+". . Unix fopen() . . popen(). . fclose().

:

	$fp = fopen("/home/rasmus/file.txt","r");
fputs(fp,string)
Fputs() , fopen(). - , fopen() . , , \n, \r \t, , . . fgets().
fseek(fp,pos)

fopen(). , pos. . ftell() rewind().

fp = fsockopen(hostname,port)

Fsockopen() c . fgets, fputs fclose. - . : -3, , -4, hostname , -5 , , -, -6 fdopen() -7, setvbuf(). 0, hostname (File NameSpace), .

pos = ftell(fp)

Ftell() , fp, fopen(). fseek(). . fseek() rewind().

getAccDir()

GetAccDir , PHP . , .

GetEnv(string)

GetEnv , . , PHP/FI . , , . GetEnv , , PHP/FI. , , http-, REMOTE_ADDR REMOTE_HOST, , GetEnv , (. $REMOTE_ADDR), , -, , - , - .

getHostByName(domain_name)

GetHostByName IP nnn.nnn.nnn.nnn.

getHostByAddr(ip_address)

GetHostByAddr IP nnn.nnn.nnn.nnn .

getLastAccess()


, PHP .

getLastbrowser()

GetLastBrowser , , .
, PHP .

getLastEmail()

GetLastEmail , .
, PHP .

getLastHost()

GetLastHost .
, PHP .

getLastMod()

GetLastMod , unix, . Date() .
, PHP .

getLastref()

GetLastRef URL, .
, PHP .

getLogDir()

GetLogDir , PHP . . , . dbm, inode , .

GetMyInode inode HTML .

getMyPid()

GetMyPid() php.

getMyUid()

GetMyUid HTML .

getRandMax()

GetRandMax , Rand. , , php.h PHP .

getStartLogging()

GetStartLogging , Unix, . mSQL, . dbm- .

getToday()

GetToday 12 .
, PHP .

getTotal()

GetTotal , .
, PHP .

GetType(variable)

GetType . , : "integer", "double" "string". . . SetType().

gmDate(format,time)

Date , , .

Header "header_string"

Header HTML , HTTP . . HTTP http.

HexDec(hex_string)

HexDec . . DecHex().

HtmlSpecialChars(string)

HtmlSpecialChars c ascii 160 255 string HTML . .

ImageArc (im, cx, cy, w, h, s, e, col)

ImageArc , cx, cy ( - 0,0) , im. W h , , s e.
, PHP GD .

ImageChar(im, size, x, y, c, col)

ImageChar c , im x, y ( - 0,0) col. 1, 2, 3, 4 5 , . 1 , 5 .
, PHP GD.

ImageCharUp(im, size, x, y, c, col)

ImageCharUp c , , im x, y ( - 0,0) col . 1, 2, 3, 4 5 , . 1 , 5 .

col = ImageColorAllocate(im, red, green, blue)

ImageColorAllocate , RGB . im - ImageCreate. ImageColorAllocate , , im.
, PHP GD.

ImageColorTransparent(im, col)

ImageColorTransparent im col. Im - , ImageCreate, col - , ImageColorAllocate.
, PHP GD.

ImageCopyResized(dst_im, src_im, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH)

ImageCopyResized . Dst_im - , src_im - . , , , . . ( dst_im src_im) , .
, PHP GD.

ImageCreate , x_size y_size.
, PHP GD.

im = ImageCreateFromGif(filename)

ImageCreateFromGif , , filename.
, PHP GD.

ImageDestroy(im) ImageDestroy , im. Im - , ImageCreate.
, PHP GD.
ImageFill(im, x, y, col) ImageFill , x, y ( - 0,0), col im.
, PHP GD.
ImageFilledPolygon(im, points, num_points, col)

ImageFilledPolygon im. Points - PHP, . . Points[0] = x0, points[1] = y0, points[2] = x1, points[3] = y1, .. num_points - .
, PHP GD.

ImageFilledRectangle(im, x1, y1, x2, y2, col)

ImageFilledRectangle col im, x1, y1 x2, y2. 0,0 - .
, PHP GD.

ImageFillToBorder(im, x, y, border, col)


, PHP GD.

ImageGif(im [,filename])

ImageGif GIF, filenam im. im - ImageCreate. , , . content-type image/gif, Header(), PHP/FI, GIF .
, PHP GD.

ImageInterlace(im, interlace)

ImageInterlace , (interlace). interlace 1, im interlace, interlace - 0, . , PHP GD.

ImageLine(im, x1, y1, x2, y2, col)

ImageLine x1, y1 x2, y2 ( - 0,0) im col.
, PHP GD.

ImagePolygon (im, points, num_points, col)

ImagePolygon im. points - PHP, . . points[0] = x0, points[1] = y0, points[2] = x1, points[3] = y1, .. Num_points - .
, PHP GD.

ImageRectangle (im, x1, y1, x2, y2, col)

col im x1, y1 x2, y2. 0,0 - .
, PHP GD.

ImageSetPixel(im, x, y, col)

ImageSetPixel x, y ( - 0,0) im col.
, PHP GD.

ImageString (im, size, x, y, s, col)

ImageString s , im, x, y ( - 0,0) col. size 1, 2, 3, 4 5, , . 1 , 5 .
, PHP GD.

ImageStringUp (im, size, x, y, s, col)

ImageStringUp s , im, x, y ( - 0,0) col. size 1, 2, 3, 4 5, , . 1 , 5 .
, PHP GD.

ImageSX(im)

ImageSX , im.

ImageSY(im)

ImageSY , im.

Include , html . , HTML . include , . PHP , include, PHP. - , HTML .
intval(variable)

Intval , long integer. . strval() doubleval().

IsSet(variable)

IsSet 1, , 0, .

Key(variable)

Key . . Reset(), End(), Next(), Prev(). , .

Link(target,link)

Link() . . Symlink() . . ReadLink LinkInfo.

LinkInfo(path)

LinkInfo st_dev stat Unix, lstat . , , ( path), ( , S_ISLNK, stat.h). -1 .

Log(arg)

.

Log10(arg)

Log10 10.

Max(array)

, .

Microtime() Microtime() "msec sec" sec - , 00:00 , 1 , 1970 , msec - ( ). . "0.87633900 825010464".

, gettimeofday() .
Min(array) Min PHP. , . , , , .
MkDir(dir,mode)

MkDir . mode .

MkTime(hour,min,sec,mon,day,year)

MkTime Unix (long integer) , , . , . . MkTime(hour, min, sec), MkTime(mon, day, year) .

$result = msql($database,$query)

Msql mSQL. - , . . <? Msql ("MyDatabase", "select * from table") >. - , , msql. - . 0, . , , - , create, , drop, insert delete. -1. , $phperrmsg, @msql() .
, PHP mSQL .

msql_connect($hostname)

Msql_Connect IP , mSQL . msqlConnect() mSQL C API. API - , , , msql(). , msql_close, . msql_connect (), . msql , : <? Msql_connect ("localhost") >
, PHP mSQL.

msql_CreateDB($database)

Msql_CreateDB .
, PHP mSQL .

msql_dbName($result,$i)

Msql_dbName , $i , msql_ListDbs(). Msql_NumRows() , , .
, PHP mSQL.

msql_DropDB($database)


, PHP mSQL.

msql_FieldFlags($result,$i)

Msql_FieldFlags . - "not null", "primery key", "" ( ).
, PHP mSQL.

msql_FieldLen($result,$i)

Msql_FieldLen .
, PHP mSQL.

msql_FieldName($result,$i)

Msql_FieldName . - . . Msql_FieldName($result, 2); result.
, PHP mSQL.

msql_FieldType($result,$i)

Msql_FieldType msql_FieldName() . , . "int", "char" "real".
, PHP mSQL.

msql_FreeResult($result)

Msql_FreeResult , , . . , , , msql_freeresult , , .
, PHP mSQL.

$result = msql_ListDBs()

msql_dbName(), .
, PHP mSQL.

$result = msql_Listfields ($database,$tablename)

msql_listfields tablename. - , . , msql_fieldflags, msql_fieldlen, msql_fieldname, msql_fieldtype. - . -1, . , $phperrmsg, @msql(), .
, PHP mSQL.

$result = msql_ListTables($database)

msql_ListTables , msql(). msql_TableName() , .
, PHP mSQL.

msql_NumFields($result)

Msql_NumFields result. - , msql().
, PHP mSQL.

msql_NumRows($result)

Msql_NumRows result. - , msql().
, PHP mSQL.

msql_RegCase(string)

Msql_RegCase , , mSQL, . "abc" "[Aa][Bb][Cc]".
, PHP mSQL.

msql_Result($result,$i,field)

. "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($result,$i)

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

, PHP mSQL.
Next(variable)

Next . , , - ($array []). . , , , . , .

 

<?
  Reset($array);
  $i=0;
  while($i < count($array)); echo key($array);
    next($array);
    $i++;
  endwhile;
>
OctDec(octal_number)

OctDec . . DecOct().

openDir(directory)

OpenDir . , readDir, closeDir.

Ord(arg)

Ord ASCII .

PassThru(command_string [,return_var]) PassThru() Exec(), Unix. return_var , Unix. Exec System, Unix - , . , - pbmplus , . content-type image/gif pbmplus, gif, PHP/FI, .
pclose(fp)

Pclose popen().

pg_Close(connection_id)

Pg_Close Postgres95 , .
PHP Postgres95.

$connection = pg_Connect(host, port, options, tty, dbname)

Pg_Connect Postgres95. , . options tty . connection. Postgres95. . 0
PHP Postgres95.

pg_DBname(connection_id)

Pg_DBname Postgres95, .
PHP Postgres95.

pg_ErrorMessage(connection_id)

, , , , .
PHP Postgres95.

$result = pg_Exec(connection_id, query_string)

Pg_Exec SQL Postgres95, connection_id. Connection_id , pg_Connect. , , - , , Postgres95. 0 , 1 , ( insert update). , select, , 1.
PHP Postgres95.

pg_FieldName(result_id, field_number)

Pg_FieldName , Postgres95. , 0.
PHP Postgres95.

pg_FieldPrtLen(result_id, row_number, field_name)

Pg_FieldPrtLen , , ( ) Postgres95. 0. -1 .
PHP Postgres95.

Pg_FieldNum , field_name Postgres95. 0. -1 .
PHP Postgres95.

pg_FieldSize(result_id, field_name)

Pg_FieldSize ( ) field_name Postgres95. 0 . -1 .
PHP Postgres95.

pg_FieldType(result_id, field_number)

Pg_FieldType , Postgres95. 0.
PHP Postgres95.

pg_FreeResult(result_id)

Pg_FreeResult , . . , , , pg_freeresult , .
PHP Postgres95.

pg_GetLastOid()

Pg_GetLastOid , Oid, , , pg_Exec SQL insert. , Oid, -1, , , pg_Exec insert.
PHP Postgres95.

pg_Host(connection_id)


PHP Postgres95.

pg_NumFields(result_id)

Pg_NumFields () Postgres95. - , pg_Exec. -1 .
PHP Postgres95.

pg_NumRows(result_id)

Pg_NumRows Postgres95. - , pg_Exec. -1 .
PHP Postgres95.

pg_Options(connection_id)

Pg_Options , , Postgres95.
PHP Postgres95.

pg_Port(connection_id)

Pg_Port , Postgres95.
PHP Postgres95.

pg_Result(result_id, row_number, field name/index)

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(connection_id)

Pg_tty , tty Postgres95, .
PHP Postgres95.

phpInfo()

PhpInfo , "?info" URL, PHP/FI php.cgi. , PHP/FI Apache, .

phpVersion()

PhpVersion PHP/FI.

fp = popen(command,mode)

Popen . fgets, fputs fclose. - . "r" "w" . . popen UNIX C . , popen () , pclose().

Prev(variable)

Prev variable . , . . . . End(), . Next().

PutEnv(string)

PutEnv . , , PHP , , - PHP . , mSQL, PutEnv, .

QuoteMeta(arg)

QuoteMeta , arg, , , .

Rand()

Rand 0 RANDMAX. RANDMAX getRandMax

readDir()

ReadDir . , . openDir, .

ReadLink(path)

ReadLink C readlink path -1 . . LinkInfo.

reg_Match(expr,arg[,regs])

Reg_Match , . , , <?if (reg_match (" ^This. * ", "This is an example string")>, , "^This. *" , This . regs , match-, 0-10 , regs. 0 . , . , .

reg_replace(expr,replace,arg)

Reg_Replace , , . , , "This is an example string" : reg_replace(" ", "-", "This is an example string"). , . , .

Reg_Search . , , . , . regs , match , 0-10 , regs. 0 . , . , .

Rename(old,new)

old new. C rename Unix.

Reset(variable)

Reset . - . . End() Next(). :

 

	<?
	  Reset($array);
	  $i=0;
	  while($i < count($array)); 
	    echo $array[]; /* pointer automatically moves ahead one */ 
	    $i++;
	  endwhile;
	>
return(value)

Return . . .

rewind($fd)

rewind() , $fd, , fopen(). . . ftell() fseek().

rewindDir()

RewindDir . openDir, .

RmDir(dir)

SetCookie(name,value,expire,path,domain,secure)

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;
SetErrorReporting(arg)

SetErrorReporting , arg. , , 0 . . - , , '@'. . .

SetLogging(arg)

SetLogging() . arg , , .

SetShowInfo(arg)

SetShowInfo() , PHP. arg , , - .

SetType . type - , "integer", "double" "string". . GetType().

Sin(arg)

Sin . . Cos() Tan().

Sleep(secs)

Sleep secs . C sleep() Unix. . USleep().

Sort(array)

Sort , PHP . ; - , , . , , , .

Sprintf(format,arg)

Sprintf , , format arg. echo arg. , sprintf() . , . - "" , , .

Sqrt(arg)

Sqrt .

Srand(integer)

date, , . , ! rand(). .

 

	<?srand(date("s")>
strchr(string,arg)

Strchr strstr - . . , , . , , "This is an example string" , : <echo strstr($string, "an ") > : "an example string".

strlen(string)

Strlen .

strrchr(string, arg)

Strrchr , string, . , , , .

Strstr strchr - . . string, , . , , "This is an example string" , : <? echo strstr ($string, "an")> : "an example string".

strtok(string,arg)

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)

Strtolower , string, .

strtoupper(string)

strval(variable)

Strval . . intval() doubleval().

substr(string, start, length)

Substr . start. - 0. length .

Symlink() . . Link(), .

System(command_string [,return_var])

System - C, unix . , unix . , , , System, EscapeShellCmd(), , . , , PassThru(). . Exec.

Tan(arg)

Sin() Cos()

TempNam(path, prefix)

TempNam , , path , prefix. C tempnam() Unix.

Time()

Time Unix (00:00:00 . 1 1970). Date("U")Microtime.

Unlink(filename)

Unlink filename. C unlink() Unix. . RmDir() .

UnSet($var)

UrlDecode(arg) UrlDecode , UrlEncode. , URL , , . , , , .
UrlEncode(arg)

"a-zA-Z0-9_-". %xx, xx - ASCII . .

USleep(microsecs)

USleep . C usleep() Unix . . Sleep().

Virtual(filename)

Virtual - Apache - , <!-- #include virtual ... --> mod_include. - Apache. CGI .shtml , -, Apache ( .phtml , <?Include>.