PHP TOC I
|
PHP Control Structures
|
|
PHP Function handling Functions
|
|
PHP Operators
|
|
PHP Logical Operators
|
|
PHP Arithmetic Operators
|
|
PHP Incrementing/Decrementing Operators
|
|
PHP Bitwise Operators
|
|
PHP Comparison Operators
|
|
PHP Math Functions
|
|
PHP XML Manipulation Functions
|
|
PHP Network Functions
|
|
PHP Error Handling Functions
|
|
More PHP Cheat Sheet
|
PHP Function handling Functions
call_user_func_array()
Call a callback with an array of parameters
example
-----------------------------------
call_user_func()
Call the callback given by the first parameter
example
-----------------------------------
create_function()
Create an anonymous (lambda-style) function
example
-----------------------------------
forward_static_call_array()
Call a static method and pass the arguments as array
example
-----------------------------------
forward_static_call()
Call a static method
example
-----------------------------------
func_get_arg()
Return an item from the argument list
example
-----------------------------------
func_get_args()
Returns an array comprising a function's argument list
example
-----------------------------------
func_num_args()
Returns the number of arguments passed to the function
example
-----------------------------------
function_exists()
Return TRUE if the given function has been defined
example
-----------------------------------
get_defined_functions()
Returns an array of all defined functions
example
-----------------------------------
register_shutdown_function()
Register a function for execution on shutdown
example
-----------------------------------
register_tick_function()
Register a function for execution on each tick
example
-----------------------------------
unregister_tick_function()
*De-register a function for execution on each tick
example |
PHP Logical Operators
| Example |
Name |
Result |
| $a and $b |
And |
TRUE if both $a and $b are TRUE. |
| $a or $b |
Or |
TRUE if either $a or $b is TRUE. |
| $a xor $b |
Xor |
TRUE if either $a or $b is TRUE, but not both. |
| ! $a |
Not |
TRUE if $a is not TRUE. |
| $a && $b |
And |
TRUE if both $a and $b are TRUE. |
| $a || $b |
Or |
TRUE if either $a or $b is TRUE. |
PHP Arithmetic Operators
| Example |
Name |
Result |
| -$a |
Negation |
Opposite of $a. |
| $a + $b |
Addition |
Sum of $a and $b. |
| $a - $b |
Subtraction |
Difference of $a and $b. |
| $a * $b |
Multiplication |
Product of $a and $b. |
| $a / $b |
Division |
Quotient of $a and $b. |
| $a % $b |
Modulus |
Remainder of $a divided by $b. |
PHP Incrementing/Decrementing Operators
| Example |
Name |
Effect |
| ++$a |
Pre-increment |
Increments $a by one, then returns $a. |
| $a++ |
Post-increment |
Returns $a, then increments $a by one. |
| --$a |
Pre-decrement |
Decrements $a by one, then returns $a. |
| $a-- |
Post-decrement |
Returns $a, then decrements $a by one. |
PHP Bitwise Operators
| Example |
Name |
Result |
| $a & $b |
And |
Bits that are set in both $a and $b are set. |
| $a | $b |
Or (inclusive or) |
Bits that are set in either $a or $b are set. |
| $a ^ $b |
Xor (exclusive or) |
Bits that are set in $a or $b but not both are set. |
| ~ $a |
Not |
Bits that are set in $a are not set, and vice versa. |
| $a << $b |
Shift left |
Shift the bits of $a $b steps to the left (each step means "multiply by two") |
| $a >> $b |
Shift right |
Shift the bits of $a $b steps to the right (each step means "divide by two") |
PHP Comparison Operators
| Example |
Name |
Result |
| $a == $b |
Equal |
TRUE if $a is equal to $b after type juggling. |
| $a === $b |
Identical |
TRUE if $a is equal to $b, and they are of the same type. |
| $a != $b |
Not equal |
TRUE if $a is not equal to $b after type juggling. |
| $a <> $b |
Not equal |
TRUE if $a is not equal to $b after type juggling. |
| $a !== $b |
Not identical |
TRUE if $a is not equal to $b, or they are not of the same type. |
| $a < $b |
Less than |
TRUE if $a is strictly less than $b. |
| $a > $b |
Greater than |
TRUE if $a is strictly greater than $b. |
| $a <= $b |
Less than or equal to |
TRUE if $a is less than or equal to $b. |
| $a >= $b |
Greater than or equal to |
TRUE if $a is greater than or equal to $b. |
| Comparison |
with |
Various Types |
| Type of Operand 1 |
Type of Operand 2 |
Result |
| null or string |
string |
Convert NULL to "", numerical or lexical comparison |
| bool or null |
anything |
Convert to bool, FALSE < TRUE |
| object |
object |
Built-in classes can define its own comparison, different classes are uncomparable, same class - compare properties the same way as arrays (PHP 4), PHP 5 has its own explanation |
| string, resource or number |
string, resource or number |
Translate strings and resources to numbers, usual math |
| array |
array |
Array with fewer members is smaller, if key from operand 1 is not found in operand 2 then arrays are uncomparable, otherwise - compare value by value (see following example) |
| array |
anything |
array is always greater |
| object |
anything |
object is always greater |
PHP Math Functions
abs()
Absolute value
example
-----------------------------------
acos()
Arc cosine
example
-----------------------------------
acosh()
Inverse hyperbolic cosine
example
-----------------------------------
asin()
Arc sine
example
-----------------------------------
asinh()
Inverse hyperbolic sine
example
-----------------------------------
atan2()
Arc tangent of two variables
example
-----------------------------------
atan()
Arc tangent
example
-----------------------------------
atanh()
Inverse hyperbolic tangent
example
-----------------------------------
base_convert()
Convert a number between arbitrary bases
example
-----------------------------------
bindec()
Binary to decimal
example
-----------------------------------
ceil()
Round fractions up
example
-----------------------------------
cos()
Cosine
example
-----------------------------------
cosh()
Hyperbolic cosine
example
-----------------------------------
decbin()
Decimal to binary
example
-----------------------------------
dechex()
Decimal to hexadecimal
example
-----------------------------------
decoct()
Decimal to octal
example
-----------------------------------
deg2rad()
Converts the number in degrees to the radian equivalent
example
-----------------------------------
exp()
Calculates the exponent of e
example
-----------------------------------
expm1()
Returns exp(number) - 1, computed in a way that is accurate even when the value of number is close to zero
example
-----------------------------------
floor()
Round fractions down
example
-----------------------------------
fmod()
Returns the floating point remainder (modulo) of the division of the arguments
example
-----------------------------------
getrandmax()
Show largest possible random value
example
-----------------------------------
hexdec()
Hexadecimal to decimal
example
-----------------------------------
hypot()
Calculate the length of the hypotenuse of a right-angle triangle
example
-----------------------------------
is_finite()
Finds whether a value is a legal finite number
example
-----------------------------------
is_infinite()
Finds whether a value is infinite
example
-----------------------------------
is_nan()
Finds whether a value is not a number
example
-----------------------------------
lcg_value()
Combined linear congruential generator
example
-----------------------------------
log10()
Base-10 logarithm
example
-----------------------------------
log1p()
Returns log(1 + number), computed in a way that is accurate even when the value of number is close to zero
example
-----------------------------------
log()
Natural logarithm
example
-----------------------------------
max()
Find highest value
example
-----------------------------------
min()
Find lowest value
example
-----------------------------------
mt_getrandmax()
Show largest possible random value
example
-----------------------------------
mt_rand()
Generate a better random value
example
-----------------------------------
mt_srand()
Seed the better random number generator
example
-----------------------------------
octdec()
Octal to decimal
example
-----------------------------------
pi()
Get value of pi
example
-----------------------------------
pow()
Exponential expression
example
-----------------------------------
rad2deg()
Converts the radian number to the equivalent number in degrees
example
-----------------------------------
rand()
Generate a random integer
example
-----------------------------------
round()
Rounds a float
example
-----------------------------------
sin()
Sine
example
-----------------------------------
sinh()
Hyperbolic sine
example
-----------------------------------
sqrt()
Square root
example
-----------------------------------
srand()
Seed the random number generator
example
-----------------------------------
tan()
Tangent
example
-----------------------------------
tanh()
Hyperbolic tangent
example
----------------------------------- |
PHP XML Manipulation Functions
-----------------------------------
DOM
-----------------------------------
dom_import_simplexml()
Gets a DOMElement object from a SimpleXMLElement object
example
-----------------------------------
DOM CONSTANTS
http://php.net/manual/en/dom.constants.php
-----------------------------------
-----------------------------------
LIBXML
-----------------------------------
libxml_clear_errors()
Clear libxml error buffer
example
-----------------------------------
libxml_disable_entity_loader()
Disable the ability to load external entities
example
-----------------------------------
libxml_get_errors()
Retrieve array of errors
example
-----------------------------------
libxml_get_last_error()
Retrieve last error from libxml
example
-----------------------------------
libxml_set_external_entity_loader()
Changes the default external entity loader
example
-----------------------------------
libxml_set_streams_context()
Set the streams context for the next libxml document load or write
example
-----------------------------------
libxml_use_internal_errors()
Disable libxml errors and allow user to fetch error information as needed
example
-----------------------------------
LIBXML CONSTANTS
http://php.net/manual/en/libxml.constants.php
-----------------------------------
-----------------------------------
SIMPLEXML
-----------------------------------
simplexml_import_dom()
Get a SimpleXMLElement object from a DOM node.
example
-----------------------------------
simplexml_load_file()
Interprets an XML file into an object
example
-----------------------------------
simplexml_load_string()
Interprets a string of XML into an object
example
-----------------------------------
-----------------------------------
XML PARSER
-----------------------------------
utf8_decode()
Converts a string with ISO-8859-1 characters encoded with UTF-8 to single-byte ISO-8859-1
example
-----------------------------------
utf8_encode()
Encodes an ISO-8859-1 string to UTF-8
example
-----------------------------------
xml_error_string()
Get XML parser error string
example
-----------------------------------
xml_get_current_byte_index()
Get current byte index for an XML parser
example
-----------------------------------
xml_get_current_column_number()
Get current column number for an XML parser
example
-----------------------------------
xml_get_current_line_number()
Get current line number for an XML parser
example
-----------------------------------
xml_get_error_code()
Get XML parser error code
example
-----------------------------------
xml_parse_into_struct()
Parse XML data into an array structure
example
-----------------------------------
xml_parse()
Start parsing an XML document
example
-----------------------------------
xml_parser_create_ns()
Create an XML parser with namespace support
example
-----------------------------------
xml_parser_create()
Create an XML parser
example
-----------------------------------
xml_parser_free()
Free an XML parser
example
-----------------------------------
xml_parser_get_option()
Get options from an XML parser
example
-----------------------------------
xml_parser_set_option()
Set options in an XML parser
example
-----------------------------------
xml_set_character_data_handler()
Set up character data handler
example
-----------------------------------
xml_set_default_handler()
Set up default handler
example
-----------------------------------
xml_set_element_handler()
Set up start and end element handlers
example
-----------------------------------
xml_set_end_namespace_decl_handler()
Set up end namespace declaration handler
example
-----------------------------------
xml_set_external_entity_ref_handler()
Set up external entity reference handler
example
-----------------------------------
xml_set_notation_decl_handler()
Set up notation declaration handler
example
-----------------------------------
xml_set_object()
Use XML Parser within an object
example
-----------------------------------
xml_set_processing_instruction_handler()
Set up processing instruction (PI) handler
example
-----------------------------------
xml_set_start_namespace_decl_handler()
Set up start namespace declaration handler
example
-----------------------------------
xml_set_unparsed_entity_decl_handler()
*Set up unparsed entity declaration handler
example
-----------------------------------
-----------------------------------
XML PARSER CONSTANTS
-----------------------------------
XML_ERROR_NONE (integer)
XML_ERROR_NO_MEMORY (integer)
XML_ERROR_SYNTAX (integer)
XML_ERROR_NO_ELEMENTS (integer)
XML_ERROR_INVALID_TOKEN (integer)
XML_ERROR_UNCLOSED_TOKEN (integer)
XML_ERROR_PARTIAL_CHAR (integer)
XML_ERROR_TAG_MISMATCH (integer)
XML_ERROR_DUPLICATE_ATTRIBUTE (integer)
XML_ERROR_JUNK_AFTER_DOC_ELEMENT (integer)
XML_ERROR_PARAM_ENTITY_REF (integer)
XML_ERROR_UNDEFINED_ENTITY (integer)
XML_ERROR_RECURSIVE_ENTITY_REF (integer)
XML_ERROR_ASYNC_ENTITY (integer)
XML_ERROR_BAD_CHAR_REF (integer)
XML_ERROR_BINARY_ENTITY_REF (integer)
XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF (integer)
XML_ERROR_MISPLACED_XML_PI (integer)
XML_ERROR_UNKNOWN_ENCODING (integer)
XML_ERROR_INCORRECT_ENCODING (integer)
XML_ERROR_UNCLOSED_CDATA_SECTION (integer)
XML_ERROR_EXTERNAL_ENTITY_HANDLING (integer)
XML_OPTION_CASE_FOLDING (integer)
XML_OPTION_TARGET_ENCODING (integer)
XML_OPTION_SKIP_TAGSTART (integer)
XML_OPTION_SKIP_WHITE (integer)
-----------------------------------
XML_SAX_IMPL (string)
Holds the SAX implementation method. Can be libxml or expat. |
PHP Network Functions
checkdnsrr()
Check DNS records corresponding to a given Internet host name or IP address
example
-----------------------------------
closelog()
Close connection to system logger
example
-----------------------------------
define_syslog_variables()
Initializes all syslog related variables
example
-----------------------------------
dns_check_record()
Alias of checkdnsrr
example
-----------------------------------
dns_get_mx()
Alias of getmxrr
example
-----------------------------------
dns_get_record()
Fetch DNS Resource Records associated with a hostname
example
-----------------------------------
fsockopen()
Open Internet or Unix domain socket connection
example
-----------------------------------
gethostbyaddr()
Get the Internet host name corresponding to a given IP address
example
-----------------------------------
gethostbyname()
Get the IPv4 address corresponding to a given Internet host name
example
-----------------------------------
gethostbynamel()
Get a list of IPv4 addresses corresponding to a given Internet host name
example
-----------------------------------
gethostname()
Gets the host name
example
-----------------------------------
getmxrr()
Get MX records corresponding to a given Internet host name
example
-----------------------------------
getprotobyname()
Get protocol number associated with protocol name
example
-----------------------------------
getprotobynumber()
Get protocol name associated with protocol number
example
-----------------------------------
getservbyname()
Get port number associated with an Internet service and protocol
example
-----------------------------------
getservbyport()
Get Internet service which corresponds to port and protocol
example
-----------------------------------
header_register_callback()
Call a header function
example
-----------------------------------
header_remove()
Remove previously set headers
example
-----------------------------------
header()
Send a raw HTTP header
example
-----------------------------------
headers_list()
Returns a list of response headers sent (or ready to send)
example
-----------------------------------
headers_sent()
Checks if or where headers have been sent
example
-----------------------------------
http_response_code()
Get or Set the HTTP response code
example
-----------------------------------
inet_ntop()
Converts a packed internet address to a human readable representation
example
-----------------------------------
inet_pton()
Converts a human readable IP address to its packed in_addr representation
example
-----------------------------------
ip2long()
Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address
example
-----------------------------------
long2ip()
Converts an (IPv4) Internet network address into a string in Internet standard dotted format
example
-----------------------------------
openlog()
Open connection to system logger
example
-----------------------------------
pfsockopen()
Open persistent Internet or Unix domain socket connection
example
-----------------------------------
setcookie()
Send a cookie
example
-----------------------------------
setrawcookie()
Send a cookie without urlencoding the cookie value
example
-----------------------------------
socket_get_status()
Alias of stream_get_meta_data
example
-----------------------------------
socket_set_blocking()
Alias of stream_set_blocking
example
-----------------------------------
socket_set_timeout()
Alias of stream_set_timeout
example
-----------------------------------
syslog()
Generate a system log message
example
-----------------------------------
-----------------------------------
NETWORK CONSTANTS
-----------------------------------
*openlog() Options
LOG_CONS()
if there is an error while sending data to the system logger, write directly to the system console
-----------------------------------
LOG_NDELAY()
open the connection to the logger immediately
-----------------------------------
LOG_ODELAY()
(default) delay opening the connection until the first message is logged
-----------------------------------
LOG_NOWAIT()
**
-----------------------------------
LOG_PERROR()
print log message also to standard error
-----------------------------------
LOG_PID()
include PID with each message
-----------------------------------
*openlog() Facilities
LOG_AUTH()
security/authorization messages (use LOG_AUTHPRIV instead in systems where that constant is defined)
-----------------------------------
LOG_AUTHPRIV()
security/authorization messages (private)
-----------------------------------
LOG_CRON()
clock daemon (cron and at)
-----------------------------------
LOG_DAEMON()
other system daemons
-----------------------------------
LOG_KERN()
kernel messages
-----------------------------------
LOG_LOCAL0 ... LOG_LOCAL7()
reserved for local use, these are not available in Windows
-----------------------------------
LOG_LPR()
line printer subsystem
-----------------------------------
LOG_MAIL()
mail subsystem
-----------------------------------
LOG_NEWS()
USENET news subsystem
-----------------------------------
LOG_SYSLOG()
messages generated internally by syslogd
-----------------------------------
LOG_USER()
generic user-level messages
-----------------------------------
LOG_UUCP()
UUCP subsystem
-----------------------------------
*syslog() Priorities (in descending order)
LOG_EMERG()
system is unusable
-----------------------------------
LOG_ALERT()
action must be taken immediately
-----------------------------------
LOG_CRIT()
critical conditions
-----------------------------------
LOG_ERR()
error conditions
-----------------------------------
LOG_WARNING()
warning conditions
-----------------------------------
LOG_NOTICE()
normal, but significant, condition
-----------------------------------
LOG_INFO()
informational message
-----------------------------------
LOG_DEBUG()
debug-level message
-----------------------------------
*dns_get_record() Options
DNS_A()
IPv4 Address Resource
-----------------------------------
DNS_MX()
Mail Exchanger Resource
-----------------------------------
DNS_CNAME()
Alias (Canonical Name) Resource
-----------------------------------
DNS_NS()
Authoritative Name Server Resource
-----------------------------------
DNS_PTR()
Pointer Resource
-----------------------------------
DNS_HINFO()
Host Info Resource (See IANA's » Operating System Names for the meaning of these values)
-----------------------------------
DNS_SOA()
Start of Authority Resource
-----------------------------------
DNS_TXT()
Text Resource
-----------------------------------
DNS_ANY()
Any Resource Record. On most systems this returns all resource records, however it should not be counted upon for critical uses. Try DNS_ALL instead.
-----------------------------------
DNS_AAAA()
IPv6 Address Resource
-----------------------------------
DNS_ALL()
*Iteratively query the name server for each available record type. |
PHP Error Handling Functions
■ List of Parser Tokens:
http://php.net/manual/en/tokens.php
Various parts of the PHP language are represented internally by types like T_SR. PHP outputs identifiers like this one in parse errors, like "Parse error: unexpected T_SR, expecting ',' or ';' in script.php on line 10."
You're supposed to know what T_SR means. For everybody who doesn't know that, here is a table with those identifiers, PHP-syntax and references to the appropriate places in the manual.
-----------------------------------
debug_backtrace()
Generates a backtrace
example
-----------------------------------
debug_print_backtrace()
Prints a backtrace
example
-----------------------------------
error_get_last()
Get the last occurred error
example
-----------------------------------
error_log()
Send an error message somewhere
example
-----------------------------------
error_reporting()
Sets which PHP errors are reported
example
-----------------------------------
restore_error_handler()
Restores the previous error handler function
example
-----------------------------------
restore_exception_handler()
Restores the previously defined exception handler function
example
-----------------------------------
set_error_handler()
Sets a user-defined error handler function
example
-----------------------------------
set_exception_handler()
Sets a user-defined exception handler function
example
-----------------------------------
trigger_error()
Generates a user-level error/warning/notice message
example
-----------------------------------
user_error()
*Alias of trigger_error
example
-----------------------------------
-----------------------------------
ERROR HANDLING CONSTANTS
http://hu2.php.net/manual/en/errorfunc.constants.php
----------------------------------- |
| |
PHP TOC II
|
PHP Predefined Variables
|
|
PHP Array Functions
|
|
PHP String Functions
|
|
PHP Date/Time Functions
|
|
PHP Calendar Functions
|
PHP Predefined Variables
Superglobals
Superglobals are built-in variables that are always available in all scopes
Several predefined variables in PHP are "superglobals", which means they are available in all scopes throughout a script. There is no need to do global $variable; to access them within functions or methods.
These superglobal variables are:
$GLOBALS
$_SERVER
$_GET
$_POST
$_FILES
$_COOKIE
$_SESSION
$_REQUEST
$_ENV
-----------------------------------
-----------------------------------
$GLOBALS
References all variables available in global scope
An associative array containing references to all variables which are currently defined in the global scope of the script. The variable names are the keys of the array.
example
-----------------------------------
-----------------------------------
$_SERVER
Server and execution environment information
■ 8 useful server variables available in PHP: http://cdv.lt/Hs
-----------------------------------
$_SERVER['PHP_SELF']
The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar would be /test.php/foo.bar. The __FILE__ constant contains the full path and filename of the current (i.e. included) file. If PHP is running as a command-line processor this variable contains the script name since PHP 4.3.0. Previously it was not available.
'argv'
Array of arguments passed to the script. When the script is run on the command line, this gives C-style access to the command line parameters. When called via the GET method, this will contain the query string.
'argc'
Contains the number of command line parameters passed to the script (if run on the command line).
-----------------------------------
$_SERVER['GATEWAY_INTERFACE']
What revision of the CGI specification the server is using; i.e. 'CGI/1.1'.
-----------------------------------
$_SERVER['SERVER_ADDR']
The IP address of the server under which the current script is executing.
-----------------------------------
$_SERVER['SERVER_NAME']
The name of the server host under which the current script is executing. If the script is running on a virtual host, this will be the value defined for that virtual host.
-----------------------------------
$_SERVER['SERVER_SOFTWARE']
Server identification string, given in the headers when responding to requests.
-----------------------------------
$_SERVER['SERVER_PROTOCOL']
Name and revision of the information protocol via which the page was requested; i.e. 'HTTP/1.0';
-----------------------------------
$_SERVER['REQUEST_METHOD']
Which request method was used to access the page; i.e. 'GET', 'HEAD', 'POST', 'PUT'.
Note:
PHP script is terminated after sending headers (it means after producing any output without output buffering) if the request method was HEAD.
-----------------------------------
$_SERVER['REQUEST_TIME']
The timestamp of the start of the request. Available since PHP 5.1.0.
-----------------------------------
$_SERVER['REQUEST_TIME_FLOAT']
The timestamp of the start of the request, with microsecond precision. Available since PHP 5.4.0.
-----------------------------------
$_SERVER['QUERY_STRING']
The query string, if any, via which the page was accessed.
-----------------------------------
$_SERVER['DOCUMENT_ROOT']
The document root directory under which the current script is executing, as defined in the server's configuration file.
-----------------------------------
$_SERVER['HTTP_ACCEPT']
Contents of the Accept: header from the current request, if there is one.
-----------------------------------
$_SERVER['HTTP_ACCEPT_CHARSET']
Contents of the Accept-Charset: header from the current request, if there is one. Example: 'iso-8859-1,,utf-8'.*
-----------------------------------
$_SERVER['HTTP_ACCEPT_ENCODING']
Contents of the Accept-Encoding: header from the current request, if there is one. Example: 'gzip'.
-----------------------------------
$_SERVER['HTTP_ACCEPT_LANGUAGE']
Contents of the Accept-Language: header from the current request, if there is one. Example: 'en'.
■ Detect Browser Language in PHP: http://cdv.lt/I5
-----------------------------------
$_SERVER['HTTP_CONNECTION']
Contents of the Connection: header from the current request, if there is one. Example: 'Keep-Alive'.
-----------------------------------
$_SERVER['HTTP_HOST']
Contents of the Host: header from the current request, if there is one.
-----------------------------------
$_SERVER['HTTP_REFERER']
The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.
-----------------------------------
$_SERVER['HTTP_USER_AGENT']
Contents of the User-Agent: header from the current request, if there is one. This is a string denoting the user agent being which is accessing the page. A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586). Among other things, you can use this value with get_browser() to tailor your page's output to the capabilities of the user agent.
-----------------------------------
$_SERVER['HTTPS']
Set to a non-empty value if the script was queried through the HTTPS protocol.
Note: Note that when using ISAPI with IIS, the value will be off if the request was not made through the HTTPS protocol.
-----------------------------------
$_SERVER['REMOTE_ADDR']
The IP address from which the user is viewing the current page.
-----------------------------------
$_SERVER['REMOTE_HOST']
The Host name from which the user is viewing the current page. The reverse dns lookup is based off the REMOTE_ADDR of the user.
Note: Your web server must be configured to create this variable. For example in Apache you'll need HostnameLookups On inside httpd.conf for it to exist. See also gethostbyaddr().
-----------------------------------
$_SERVER['REMOTE_PORT']
The port being used on the user's machine to communicate with the web server.
-----------------------------------
$_SERVER['REMOTE_USER']
The authenticated user.
-----------------------------------
$_SERVER['REDIRECT_REMOTE_USER']
The authenticated user if the request is internally redirected.
-----------------------------------
$_SERVER['SCRIPT_FILENAME']
The absolute pathname of the currently executing script.
Note:
If a script is executed with the CLI, as a relative path, such as file.php or ../file.php, $_SERVER['SCRIPT_FILENAME'] will contain the relative path specified by the user.
-----------------------------------
$_SERVER['SERVER_ADMIN']
The value given to the SERVER_ADMIN (for Apache) directive in the web server configuration file. If the script is running on a virtual host, this will be the value defined for that virtual host.
-----------------------------------
$_SERVER['SERVER_PORT']
The port on the server machine being used by the web server for communication. For default setups, this will be '80'; using SSL, for instance, will change this to whatever your defined secure HTTP port is.
-----------------------------------
$_SERVER['SERVER_SIGNATURE']
String containing the server version and virtual host name which are added to server-generated pages, if enabled.
-----------------------------------
$_SERVER['PATH_TRANSLATED']
Filesystem- (not document root-) based path to the current script, after the server has done any virtual-to-real mapping.
Note: As of PHP 4.3.2, PATH_TRANSLATED is no longer set implicitly under the Apache 2 SAPI in contrast to the situation in Apache 1, where it's set to the same value as the SCRIPT_FILENAME server variable when it's not populated by Apache. This change was made to comply with the CGI specification that PATH_TRANSLATED should only exist if PATH_INFO is defined. Apache 2 users may use AcceptPathInfo = On inside httpd.conf to define PATH_INFO.
-----------------------------------
$_SERVER['SCRIPT_NAME']
Contains the current script's path. This is useful for pages which need to point to themselves. The __FILE__ constant contains the full path and filename of the current (i.e. included) file.
-----------------------------------
$_SERVER['REQUEST_URI']
The URI which was given in order to access this page; for instance, '/index.html'.
-----------------------------------
$_SERVER['PHP_AUTH_DIGEST']
When doing Digest HTTP authentication this variable is set to the 'Authorization' header sent by the client (which you should then use to make the appropriate validation).
-----------------------------------
$_SERVER['PHP_AUTH_USER']
When doing HTTP authentication this variable is set to the username provided by the user.
-----------------------------------
$_SERVER['PHP_AUTH_PW']
When doing HTTP authentication this variable is set to the password provided by the user.
-----------------------------------
$_SERVER['AUTH_TYPE']
When doing HTTP authenticated this variable is set to the authentication type.
-----------------------------------
$_SERVER['PATH_INFO']
Contains any client-provided pathname information trailing the actual script filename but preceding the query string, if available. For instance, if the current script was accessed via the URL http://www.example.com/php/path_info.php/some/stuff?foo=bar, then $_SERVER['PATH_INFO'] would contain /some/stuff.
-----------------------------------
$_SERVER['ORIG_PATH_INFO']
Original version of 'PATH_INFO' before processed by PHP.
-----------------------------------
-----------------------------------
$_GET
HTTP GET variables
-----------------------------------
-----------------------------------
$_POST
HTTP POST variables
-----------------------------------
-----------------------------------
$_FILES
HTTP File Upload variables
-----------------------------------
-----------------------------------
$_REQUEST
HTTP Request variables
An associative array that by default contains the contents of $_GET, $_POST and $_COOKIE.
-----------------------------------
-----------------------------------
$_SESSION
Session variables
An associative array containing session variables available to the current script. See the Session functions documentation for more information on how this is used.
Session functions:
http://php.net/manual/en/ref.session.php
-----------------------------------
-----------------------------------
$_ENV
Environment variables
An associative array of variables passed to the current script via the environment method.
These variables are imported into PHP's global namespace from the environment under which the PHP parser is running. Many are provided by the shell under which PHP is running and different systems are likely running different kinds of shells, a definitive list is impossible. Please see your shell's documentation for a list of defined environment variables.
-----------------------------------
-----------------------------------
$_COOKIE
HTTP Cookies
An associative array of variables passed to the current script via HTTP Cookies.
-----------------------------------
-----------------------------------
$php_errormsg
*The previous error message
$php_errormsg is a variable containing the text of the last error message generated by PHP. This variable will only be available within the scope in which the error occurred, and only if the track_errors configuration option is turned on (it defaults to off).*
Note: This variable is only available when track_errors is enabled in php.ini.
Warning: If a user defined error handler ( set_error_handler()) is set $php_errormsg is only set if the error handler returns FALSE.
-----------------------------------
-----------------------------------
$HTTP_RAW_POST_DATA
Raw POST data
$HTTP_RAW_POST_DATA contains the raw POST data.
See always_populate_raw_post_data
http://php.net/manual/en/ini.core.php#ini.always-populate-raw-post-data
-----------------------------------
-----------------------------------
$http_response_header
HTTP response headers
The $http_response_header array is similar to the get_headers() function. When using the HTTP wrapper, $http_response_header will be populated with the HTTP response headers. $http_response_header will be created in the local scope.
http://php.net/manual/en/wrappers.http.php
http://php.net/manual/en/language.variables.scope.php
-----------------------------------
-----------------------------------
$argc
The number of arguments passed to script
Contains the number of arguments passed to the current script when running from the command line.
Note: The script's filename is always passed as an argument to the script, therefore the minimum value of $argc is 1.
Note: This variable is not available when register_argc_argv is disabled.
-----------------------------------
-----------------------------------
$argv
Array of arguments passed to script
Contains an array of all the arguments passed to the script when running from the command line.
Note: The first argument $argv[0] is always the name that was used to run the script.
Note: This variable is not available when register_argc_argv is disabled.
----------------------------------- |
PHP Array Functions
array_change_key_case()
Changes all keys in an array
■ http://cdv.lt/Hn
-----------------------------------
array_chunk()
Split an array into chunks
■ http://cdv.lt/Ho
-----------------------------------
array_combine()
Creates an array by using one array for keys and another for its values
■ http://cdv.lt/Ht
-----------------------------------
array_count_values()
Counts all the values of an array
■ http://cdv.lt/Hv
-----------------------------------
array_diff_assoc()
Computes the difference of arrays with additional index check
■ http://cdv.lt/Hw
-----------------------------------
array_diff_key()
Computes the difference of arrays using keys for comparison
■ http://cdv.lt/Hx
-----------------------------------
array_diff_uassoc()
Computes the difference of arrays with additional index check which is performed by a user supplied callback function
■ http://cdv.lt/I1
-----------------------------------
array_diff_ukey()
Computes the difference of arrays using a callback function on the keys for comparison
■ http://cdv.lt/I2
-----------------------------------
array_diff()
Computes the difference of arrays
■ http://cdv.lt/I3
-----------------------------------
array_fill_keys()
Fill an array with values, specifying keys
■ http://cdv.lt/IH
-----------------------------------
array_fill()
Fill an array with values
■ http://cdv.lt/II
-----------------------------------
array_filter()
Filters elements of an array using a callback function
■ http://cdv.lt/IJ
-----------------------------------
array_flip()
Exchanges all keys with their associated values in an array
example
-----------------------------------
array_intersect_assoc()
Computes the intersection of arrays with additional index check
example
-----------------------------------
array_intersect_key()
Computes the intersection of arrays using keys for comparison
example
-----------------------------------
array_intersect_uassoc()
Computes the intersection of arrays with additional index check, compares indexes by a callback function
example
-----------------------------------
array_intersect_ukey()
Computes the intersection of arrays using a callback function on the keys for comparison
example
-----------------------------------
array_intersect()
Computes the intersection of arrays
example
-----------------------------------
array_key_exists()
Checks if the given key or index exists in the array
example
-----------------------------------
array_keys()
Return all the keys or a subset of the keys of an array
example
-----------------------------------
array_map()
Applies the callback to the elements of the given arrays
example
-----------------------------------
array_merge_recursive()
Merge two or more arrays recursively
example
-----------------------------------
array_merge()
Merge one or more arrays
example
-----------------------------------
array_pad()
Pad array to the specified length with a value
example
-----------------------------------
array_pop()
Pop the element off the end of array
example
-----------------------------------
array_product()
Calculate the product of values in an array
example
-----------------------------------
array_push()
Push one or more elements onto the end of array
example
-----------------------------------
array_rand()
Pick one or more random entries out of an array
example
-----------------------------------
array_reduce()
Iteratively reduce the array to a single value using a callback function
example
-----------------------------------
array_replace_recursive()
Replaces elements from passed arrays into the first array recursively
example
-----------------------------------
array_replace()
Replaces elements from passed arrays into the first array
example
-----------------------------------
array_reverse()
Return an array with elements in reverse order
example
-----------------------------------
array_search()
Searches the array for a given value and returns the corresponding key if successful
example
-----------------------------------
array_shift()
Shift an element off the beginning of array
example
-----------------------------------
array_slice()
Extract a slice of the array
example
-----------------------------------
array_splice()
Remove a portion of the array and replace it with something else
example
-----------------------------------
array_sum()
Calculate the sum of values in an array
example
-----------------------------------
array_udiff_assoc()
Computes the difference of arrays with additional index check, compares data by a callback function
example
-----------------------------------
array_udiff_uassoc()
Computes the difference of arrays with additional index check, compares data and indexes by a callback function
example
-----------------------------------
array_udiff()
Computes the difference of arrays by using a callback function for data comparison
example
-----------------------------------
array_uintersect_assoc()
Computes the intersection of arrays with additional index check, compares data by a callback function
example
-----------------------------------
array_uintersect_uassoc()
Computes the intersection of arrays with additional index check, compares data and indexes by a callback functions
example
-----------------------------------
array_uintersect()
Computes the intersection of arrays, compares data by a callback function
example
-----------------------------------
array_unique()
Removes duplicate values from an array
example
-----------------------------------
array_unshift()
Prepend one or more elements to the beginning of an array
example
-----------------------------------
array_values()
Return all the values of an array
example
-----------------------------------
array_walk_recursive()
Apply a user function recursively to every member of an array
example
-----------------------------------
array_walk()
Apply a user function to every member of an array
example
-----------------------------------
array()
Create an array
example
-----------------------------------
compact()
Create array containing variables and their values
example
-----------------------------------
count()
Count all elements in an array, or something in an object
example
-----------------------------------
current()
Return the current element in an array
example
-----------------------------------
each()
Return the current key and value pair from an array and advance the array cursor
example
-----------------------------------
end()
Set the internal pointer of an array to its last element
example
-----------------------------------
extract()
Import variables into the current symbol table from an array
example
-----------------------------------
in_array()
Checks if a value exists in an array
example
-----------------------------------
key()
Fetch a key from an array
example
-----------------------------------
list()
Assign variables as if they were an array
example
-----------------------------------
next()
Advance the internal array pointer of an array
example
-----------------------------------
pos()
Alias of current
example
-----------------------------------
prev()
Rewind the internal array pointer
example
-----------------------------------
range()
Create an array containing a range of elements
example
-----------------------------------
reset()
Set the internal pointer of an array to its first element
example
-----------------------------------
sizeof()
Alias of count
ARRAY SORTING FUNCTIONS
example
-----------------------------------
array_multisort()
Sort multiple or multi-dimensional arrays
example
-----------------------------------
asort()
Sort an array and maintain index association
example
-----------------------------------
arsort()
Sort an array in reverse order and maintain index association
example
-----------------------------------
krsort()
Sort an array by key in reverse order
example
-----------------------------------
ksort()
Sort an array by key
example
-----------------------------------
natcasesort()
Sort an array using a case insensitive "natural order" algorithm
example
-----------------------------------
natsort()
Sort an array using a "natural order" algorithm
example
-----------------------------------
rsort()
Sort an array in reverse order
example
-----------------------------------
shuffle()
Shuffle an array
example
-----------------------------------
sort()
Sort an array
example
-----------------------------------
uasort()
Sort an array with a user-defined comparison function and maintain index association
example
-----------------------------------
uksort()
Sort an array by keys using a user-defined comparison function
example
-----------------------------------
usort()
Sort an array by values using a user-defined comparison function
example
-----------------------------------
-----------------------------------
Comparison of array sorting functions
http://php.net/manual/en/array.sorting.php
-----------------------------------
-----------------------------------
ARRAY CONSTANTS
-----------------------------------
CASE_LOWER
Used with array_change_key_case() to convert array keys to lower case
-----------------------------------
CASE_UPPER
Used with array_change_key_case() to convert array keys to upper case
-----------------------------------
SORT_ASC
Used with array_multisort() to sort in ascending order
-----------------------------------
SORT_DESC
Used with array_multisort() to sort in descending order
-----------------------------------
SORT_REGULAR
Used to compare items normally
-----------------------------------
SORT_NUMERIC
Used to compare items numerically
-----------------------------------
SORT_STRING
Used to compare items as strings
-----------------------------------
SORT_LOCALE_STRING
Used to compare items as strings, based on the current locale
-----------------------------------
COUNT_NORMAL
COUNT_RECURSIVE
EXTR_OVERWRITE
EXTR_SKIP
EXTR_PREFIX_SAME
EXTR_PREFIX_ALL
EXTR_PREFIX_INVALID
EXTR_PREFIX_IF_EXISTS
EXTR_IF_EXISTS
EXTR_REFS |
PHP String Functions
addcslashes()
Quote string with slashes in a C style
example
-----------------------------------
addslashes()
Quote string with slashes
example
-----------------------------------
bin2hex()
Convert binary data into hexadecimal representation
example
-----------------------------------
chop()
Alias of rtrim
example
-----------------------------------
chr()
Return a specific character
example
-----------------------------------
chunk_split()
Split a string into smaller chunks
example
-----------------------------------
convert_cyr_string()
Convert from one Cyrillic character set to another
example
-----------------------------------
convert_uudecode()
Decode a uuencoded string
example
-----------------------------------
convert_uuencode()
Uuencode a string
example
-----------------------------------
count_chars()
Return information about characters used in a string
example
-----------------------------------
crc32()
Calculates the crc32 polynomial of a string
example
-----------------------------------
crypt()
One-way string hashing
example
-----------------------------------
echo()
Output one or more strings
■ http://cdv.lt/Hm
-----------------------------------
explode()
Split a string by string
example
-----------------------------------
fprintf()
Write a formatted string to a stream
example
-----------------------------------
get_html_translation_table()
Returns the translation table used by htmlspecialchars and htmlentities
example
-----------------------------------
hebrev()
Convert logical Hebrew text to visual text
example
-----------------------------------
hebrevc()
Convert logical Hebrew text to visual text with newline conversion
example
-----------------------------------
hex2bin()
Decodes a hexadecimally encoded binary string
example
-----------------------------------
html_entity_decode()
Convert all HTML entities to their applicable characters
example
-----------------------------------
htmlentities()
Convert all applicable characters to HTML entities
example
-----------------------------------
htmlspecialchars_decode()
Convert special HTML entities back to characters
example
-----------------------------------
htmlspecialchars()
Convert special characters to HTML entities
example
-----------------------------------
implode()
Join array elements with a string
example
-----------------------------------
join()
Alias of implode
example
-----------------------------------
lcfirst()
Make a string's first character lowercase
example
-----------------------------------
levenshtein()
Calculate Levenshtein distance between two strings
example
-----------------------------------
localeconv()
Get numeric formatting information
example
-----------------------------------
ltrim()
Strip whitespace (or other characters) from the beginning of a string
example
-----------------------------------
md5_file()
Calculates the md5 hash of a given file
example
-----------------------------------
md5()
Calculate the md5 hash of a string
example
-----------------------------------
metaphone()
Calculate the metaphone key of a string
example
-----------------------------------
money_format()
Formats a number as a currency string
example
-----------------------------------
nl_langinfo()
Query language and locale information
example
-----------------------------------
nl2br()
Inserts HTML line breaks before all newlines in a string
example
-----------------------------------
number_format()
Format a number with grouped thousands
example
-----------------------------------
ord()
Return ASCII value of character
example
-----------------------------------
parse_str()
Parses the string into variables
example
-----------------------------------
print()
Output a string
example
-----------------------------------
printf()
Output a formatted string
example
-----------------------------------
quoted_printable_decode()
Convert a quoted-printable string to an 8 bit string
example
-----------------------------------
quoted_printable_encode()
Convert a 8 bit string to a quoted-printable string
example
-----------------------------------
quotemeta()
Quote meta characters
example
-----------------------------------
rtrim()
Strip whitespace (or other characters) from the end of a string
example
-----------------------------------
setlocale()
Set locale information
example
-----------------------------------
sha1_file()
Calculate the sha1 hash of a file
example
-----------------------------------
sha1()
Calculate the sha1 hash of a string
example
-----------------------------------
similar_text()
Calculate the similarity between two strings
example
-----------------------------------
soundex()
Calculate the soundex key of a string
example
-----------------------------------
sprintf()
Return a formatted string
example
-----------------------------------
sscanf()
Parses input from a string according to a format
example
-----------------------------------
str_getcsv()
Parse a CSV string into an array
example
-----------------------------------
str_ireplace()
Case-insensitive version of str_replace.
example
-----------------------------------
str_pad()
Pad a string to a certain length with another string
example
-----------------------------------
str_repeat()
Repeat a string
example
-----------------------------------
str_replace()
Replace all occurrences of the search string with the replacement string
example
-----------------------------------
str_rot13()
Perform the rot13 transform on a string
example
-----------------------------------
str_shuffle()
Randomly shuffles a string
example
-----------------------------------
str_split()
Convert a string to an array
example
-----------------------------------
str_word_count()
Return information about words used in a string
example
-----------------------------------
strcasecmp()
Binary safe case-insensitive string comparison
example
-----------------------------------
strchr()
Alias of strstr
example
-----------------------------------
strcmp()
Binary safe string comparison
example
-----------------------------------
strcoll()
Locale based string comparison
example
-----------------------------------
strcspn()
Find length of initial segment not matching mask
example
-----------------------------------
strip_tags()
Strip HTML and PHP tags from a string
example
-----------------------------------
stripcslashes()
Un-quote string quoted with addcslashes
example
-----------------------------------
stripos()
Find the position of the first occurrence of a case-insensitive substring in a string
example
-----------------------------------
stripslashes()
Un-quotes a quoted string
example
-----------------------------------
stristr()
Case-insensitive strstr
example
-----------------------------------
strlen()
Get string length
example
-----------------------------------
strnatcasecmp()
Case insensitive string comparisons using a "natural order" algorithm
example
-----------------------------------
strnatcmp()
String comparisons using a "natural order" algorithm
example
-----------------------------------
strncasecmp()
Binary safe case-insensitive string comparison of the first n characters
example
-----------------------------------
strncmp()
Binary safe string comparison of the first n characters
example
-----------------------------------
strpbrk()
Search a string for any of a set of characters
example
-----------------------------------
strpos()
Find the position of the first occurrence of a substring in a string
example
-----------------------------------
strrchr()
Find the last occurrence of a character in a string
example
-----------------------------------
strrev()
Reverse a string
example
-----------------------------------
strripos()
Find the position of the last occurrence of a case-insensitive substring in a string
example
-----------------------------------
strrpos()
Find the position of the last occurrence of a substring in a string
example
-----------------------------------
strspn()
Finds the length of the initial segment of a string consisting entirely of characters contained within a given mask.
example
-----------------------------------
strstr()
Find the first occurrence of a string
example
-----------------------------------
strtok()
Tokenize string
example
-----------------------------------
strtolower()
Make a string lowercase
example
-----------------------------------
strtoupper()
Make a string uppercase
example
-----------------------------------
strtr()
Translate characters or replace substrings
example
-----------------------------------
substr_compare()
Binary safe comparison of two strings from an offset, up to length characters
example
-----------------------------------
substr_count()
Count the number of substring occurrences
example
-----------------------------------
substr_replace()
Replace text within a portion of a string
example
-----------------------------------
substr()
Return part of a string
example
-----------------------------------
trim()
Strip whitespace (or other characters) from the beginning and end of a string
example
-----------------------------------
ucfirst()
Make a string's first character uppercase
example
-----------------------------------
ucwords()
Uppercase the first character of each word in a string
example
-----------------------------------
vfprintf()
Write a formatted string to a stream
example
-----------------------------------
vprintf()
Output a formatted string
example
-----------------------------------
vsprintf()
Return a formatted string
example
-----------------------------------
wordwrap()
Wraps a string to a given number of characters
example
-----------------------------------
-----------------------------------
STRING CONSTANTS
-----------------------------------
CRYPT_SALT_LENGTH
Contains the length of the default encryption method for the system. For standard DES encryption, the length is 2
-----------------------------------
CRYPT_STD_DES
Set to 1 if the standard DES-based encryption with a 2 character salt is supported, 0 otherwise
-----------------------------------
CRYPT_EXT_DES
Set to 1 if the extended DES-based encryption with a 9 character salt is supported, 0 otherwise
-----------------------------------
CRYPT_MD5
Set to 1 if the MD5 encryption with a 12 character salt starting with $1$ is supported, 0 otherwise
-----------------------------------
CRYPT_BLOWFISH
Set to 1 if the Blowfish encryption with a 16 character salt starting with $2$ or $2a$ is supported, 0 otherwise0
-----------------------------------
HTML_SPECIALCHARS
HTML_ENTITIES
ENT_COMPAT
ENT_QUOTES
ENT_NOQUOTES
CHAR_MAX
LC_CTYPE
LC_NUMERIC
LC_TIME
LC_COLLATE
LC_MONETARY
LC_ALL
LC_MESSAGES
STR_PAD_LEFT
STR_PAD_RIGHT
STR_PAD_BOTH |
PHP Date/Time Functions
checkdate()
Validate a Gregorian date
example
-----------------------------------
date_add()
Alias of DateTime::add
example
-----------------------------------
date_create_from_format()
Alias of DateTime::createFromFormat
example
-----------------------------------
date_create()
Alias of DateTime::__construct
example
-----------------------------------
date_date_set()
Alias of DateTime::setDate
example
-----------------------------------
date_default_timezone_get()
Gets the default timezone used by all date/time functions in a script
example
-----------------------------------
date_default_timezone_set()
Sets the default timezone used by all date/time functions in a script
example
-----------------------------------
date_diff()
Alias of DateTime::diff
example
-----------------------------------
date_format()
Alias of DateTime::format
example
-----------------------------------
date_get_last_errors()
Alias of DateTime::getLastErrors
example
-----------------------------------
date_interval_create_from_date_string()
Alias of DateInterval::createFromDateString
example
-----------------------------------
date_interval_format()
Alias of DateInterval::format
example
-----------------------------------
date_isodate_set()
Alias of DateTime::setISODate
example
-----------------------------------
date_modify()
Alias of DateTime::modify
example
-----------------------------------
date_offset_get()
Alias of DateTime::getOffset
example
-----------------------------------
date_parse_from_format()
Get info about given date formatted according to the specified format
example
-----------------------------------
date_parse()
Returns associative array with detailed info about given date
example
-----------------------------------
date_sub()
Alias of DateTime::sub
example
-----------------------------------
date_sun_info()
Returns an array with information about sunset/sunrise and twilight begin/end
example
-----------------------------------
date_sunrise()
Returns time of sunrise for a given day and location
example
-----------------------------------
date_sunset()
Returns time of sunset for a given day and location
example
-----------------------------------
date_time_set()
Alias of DateTime::setTime
example
-----------------------------------
date_timestamp_get()
Alias of DateTime::getTimestamp
example
-----------------------------------
date_timestamp_set()
Alias of DateTime::setTimestamp
example
-----------------------------------
date_timezone_get()
Alias of DateTime::getTimezone
example
-----------------------------------
date_timezone_set()
Alias of DateTime::setTimezone
example
-----------------------------------
date()
Format a local time/date
http://hu1.php.net/manual/en/function.date.php
example
-----------------------------------
getdate()
Get date/time information
example
-----------------------------------
gettimeofday()
Get current time
example
-----------------------------------
gmdate()
Format a GMT/UTC date/time
example
-----------------------------------
gmmktime()
Get Unix timestamp for a GMT date
example
-----------------------------------
gmstrftime()
Format a GMT/UTC time/date according to locale settings
example
-----------------------------------
idate()
Format a local time/date as integer
example
-----------------------------------
localtime()
Get the local time
example
-----------------------------------
microtime()
Return current Unix timestamp with microseconds
example
-----------------------------------
mktime()
Get Unix timestamp for a date
example
-----------------------------------
strftime()
Format a local time/date according to locale settings
http://hu1.php.net/manual/en/function.strftime.php
example
-----------------------------------
strptime()
Parse a time/date generated with strftime
example
-----------------------------------
strtotime()
Parse about any English textual datetime description into a Unix timestamp
example
-----------------------------------
time()
Return current Unix timestamp
example
-----------------------------------
timezone_abbreviations_list()
Alias of DateTimeZone::listAbbreviations
example
-----------------------------------
timezone_identifiers_list()
Alias of DateTimeZone::listIdentifiers
example
-----------------------------------
timezone_location_get()
Alias of DateTimeZone::getLocation
example
-----------------------------------
timezone_name_from_abbr()
Returns the timezone name from abbreviation
example
-----------------------------------
timezone_name_get()
Alias of DateTimeZone::getName
example
-----------------------------------
timezone_offset_get()
Alias of DateTimeZone::getOffset
example
-----------------------------------
timezone_open()
Alias of DateTimeZone::__construct
example
-----------------------------------
timezone_transitions_get()
Alias of DateTimeZone::getTransitions
example
-----------------------------------
timezone_version_get()
Gets the version of the timezonedb
example
-----------------------------------
-----------------------------------
DATE/TIME CONSTANTS
-----------------------------------
DATE_ATOM
Atom
example: 2005-08-15T16:13:03+0000
-----------------------------------
DATE_COOKIE
HTTP Cookies
example: Sun, 14 Aug 2005 16:13:03 UTC
-----------------------------------
DATE_ISO8601
ISO-8601
example: 2005-08-14T16:13:03+0000
-----------------------------------
DATE_RFC822
RFC 822
example: Sun, 14 Aug 2005 16:13:03 UTC
-----------------------------------
DATE_RFC850
RFC 850
example: Sunday, 14-Aug-05 16:13:03 UTC
-----------------------------------
DATE_RFC1036
RFC 1036
example: Sunday, 14-Aug-05 16:13:03 UTC
-----------------------------------
DATE_RFC1123
RFC 1123
example: Sun, 14 Aug 2005 16:13:03 UTC
-----------------------------------
DATE_RFC2822
RFC 2822
Sun, 14 Aug 2005 16:13:03 +0000
-----------------------------------
DATE_RSS
RSS
Sun, 14 Aug 2005 16:13:03 UTC
-----------------------------------
DATE_W3C
World Wide Web Consortium
example: 2005-08-14T16:13:03+0000 |
PHP Calendar Functions
cal_days_in_month()
Return the number of days in a month for a given year and calendar
example
-----------------------------------
cal_from_jd()
Converts from Julian Day Count to a supported calendar
example
-----------------------------------
cal_info()
Returns information about a particular calendar
example
-----------------------------------
cal_to_jd()
Converts from a supported calendar to Julian Day Count
example
-----------------------------------
easter_date()
Get Unix timestamp for midnight on Easter of a given year
example
-----------------------------------
easter_days()
Get number of days after March 21 on which Easter falls for a given year
example
-----------------------------------
FrenchToJD()
Converts a date from the French Republican Calendar to a Julian Day Count
example
-----------------------------------
GregorianToJD()
Converts a Gregorian date to Julian Day Count
example
-----------------------------------
JDDayOfWeek()
Returns the day of the week
example
-----------------------------------
JDMonthName()
Returns a month name
example
-----------------------------------
JDToFrench()
Converts a Julian Day Count to the French Republican Calendar
example
-----------------------------------
JDToGregorian()
Converts Julian Day Count to Gregorian date
example
-----------------------------------
jdtojewish()
Converts a Julian day count to a Jewish calendar date
example
-----------------------------------
JDToJulian()
Converts a Julian Day Count to a Julian Calendar Date
example
-----------------------------------
jdtounix()
Convert Julian Day to Unix timestamp
example
-----------------------------------
JewishToJD()
Converts a date in the Jewish Calendar to Julian Day Count
example
-----------------------------------
JulianToJD()
Converts a Julian Calendar date to Julian Day Count
example
-----------------------------------
unixtojd()
*Convert Unix timestamp to Julian Day
example
-----------------------------------
-----------------------------------
CALENDAR CONSTANTS
-----------------------------------
CAL_GREGORIAN
Gregorian calendar
-----------------------------------
CAL_JULIAN
Julian calendar
-----------------------------------
CAL_JEWISH
Jewish calendar
-----------------------------------
CAL_FRENCH
French Republican calendar
-----------------------------------
CAL_NUM_CALS
CAL_DOW_DAYNO
CAL_DOW_SHORT
CAL_DOW_LONG
CAL_MONTH_GREGORIAN_SHORT
CAL_MONTH_GREGORIAN_LONG
CAL_MONTH_JULIAN_SHORT
CAL_MONTH_JULIAN_LONG
CAL_MONTH_JEWISH
CAL_MONTH_FRENCH
CAL_EASTER_DEFAULT
CAL_EASTER_ROMAN
CAL_EASTER_ALWAYS_GREGORIAN
CAL_EASTER_ALWAYS_JULIAN
CAL_JEWISH_ADD_ALAFIM_GERESH
CAL_JEWISH_ADD_ALAFIM
CAL_JEWISH_ADD_GERESHAYIM |
| |
PHP TOC III
|
PHP PCRE Functions (REGEX)
|
|
PHP Mail Functions
|
|
PHP MySQL Functions
|
|
PHP Filesystem Functions
|
|
PHP Directory Functions
|
|
PHP FTP Functions
|
|
PHP ZIP Functions
|
|
PHP Filter Functions
|
|
PHP Misc Functions
|
PHP PCRE Functions (REGEX)
preg_filter()
Perform a regular expression search and replace
example
-----------------------------------
preg_grep()
Return array entries that match the pattern
example
-----------------------------------
preg_last_error()
Returns the error code of the last PCRE regex execution
example
-----------------------------------
preg_match_all()
Perform a global regular expression match
example
-----------------------------------
preg_match()
Perform a regular expression match
example
-----------------------------------
preg_quote()
Quote regular expression characters
example
-----------------------------------
preg_replace_callback()
Perform a regular expression search and replace using a callback
example
-----------------------------------
preg_replace()
Perform a regular expression search and replace
example
-----------------------------------
preg_split()
*Split string by a regular expression
example
-----------------------------------
-----------------------------------
PCRE CONSTANTS
http://hu2.php.net/manual/en/pcre.constants.php
----------------------------------- |
PHP Mail Functions
ezmlm_hash
Calculate the hash value needed by EZMLM
example
-----------------------------------
mail
Send mail
example
----------------------------------- |
PHP MySQL Functions
mysql_affected_rows()
Get number of affected rows in previous MySQL operation
example
-----------------------------------
mysql_client_encoding()
Returns the name of the character set
example
-----------------------------------
mysql_close()
Close MySQL connection
example
-----------------------------------
mysql_connect()
Open a connection to a MySQL Server
example
-----------------------------------
mysql_create_db()
Create a MySQL database
example
-----------------------------------
mysql_data_seek()
Move internal result pointer
example
-----------------------------------
mysql_db_name()
Retrieves database name from the call to mysql_list_dbs
example
-----------------------------------
mysql_db_query()
Selects a database and executes a query on it
example
-----------------------------------
mysql_drop_db()
Drop (delete) a MySQL database
example
-----------------------------------
mysql_errno()
Returns the numerical value of the error message from previous MySQL operation
example
-----------------------------------
mysql_error()
Returns the text of the error message from previous MySQL operation
example
-----------------------------------
mysql_escape_string()
Escapes a string for use in a mysql_query
example
-----------------------------------
mysql_fetch_array()
Fetch a result row as an associative array, a numeric array, or both
example
-----------------------------------
mysql_fetch_assoc()
Fetch a result row as an associative array
example
-----------------------------------
mysql_fetch_field()
Get column information from a result and return as an object
example
-----------------------------------
mysql_fetch_lengths()
Get the length of each output in a result
example
-----------------------------------
mysql_fetch_object()
Fetch a result row as an object
example
-----------------------------------
mysql_fetch_row()
Get a result row as an enumerated array
example
-----------------------------------
mysql_field_flags()
Get the flags associated with the specified field in a result
example
-----------------------------------
mysql_field_len()
Returns the length of the specified field
example
-----------------------------------
mysql_field_name()
Get the name of the specified field in a result
example
-----------------------------------
mysql_field_seek()
Set result pointer to a specified field offset
example
-----------------------------------
mysql_field_table()
Get name of the table the specified field is in
example
-----------------------------------
mysql_field_type()
Get the type of the specified field in a result
example
-----------------------------------
mysql_free_result()
Free result memory
example
-----------------------------------
mysql_get_client_info()
Get MySQL client info
example
-----------------------------------
mysql_get_host_info()
Get MySQL host info
example
-----------------------------------
mysql_get_proto_info()
Get MySQL protocol info
example
-----------------------------------
mysql_get_server_info()
Get MySQL server info
example
-----------------------------------
mysql_info()
Get information about the most recent query
example
-----------------------------------
mysql_insert_id()
Get the ID generated in the last query
example
-----------------------------------
mysql_list_dbs()
List databases available on a MySQL server
example
-----------------------------------
mysql_list_fields()
List MySQL table fields
example
-----------------------------------
mysql_list_processes()
List MySQL processes
example
-----------------------------------
mysql_list_tables()
List tables in a MySQL database
example
-----------------------------------
mysql_num_fields()
Get number of fields in result
example
-----------------------------------
mysql_num_rows()
Get number of rows in result
example
-----------------------------------
mysql_pconnect()
Open a persistent connection to a MySQL server
example
-----------------------------------
mysql_ping()
Ping a server connection or reconnect if there is no connection
example
-----------------------------------
mysql_query()
Send a MySQL query
example
-----------------------------------
mysql_real_escape_string()
Escapes special characters in a string for use in an SQL statement
example
-----------------------------------
mysql_result()
Get result data
example
-----------------------------------
mysql_select_db()
Select a MySQL database
example
-----------------------------------
mysql_set_charset()
Sets the client character set
example
-----------------------------------
mysql_stat()
Get current system status
example
-----------------------------------
mysql_tablename()
Get table name of field
example
-----------------------------------
mysql_thread_id()
Return the current thread ID
example
-----------------------------------
mysql_unbuffered_query()
Send an SQL query to MySQL without fetching and buffering the result rows.
example
-----------------------------------
-----------------------------------
MySQL CONSTANTS
-----------------------------------
MYSQL_CLIENT_COMPRESS
Use compression protocol
-----------------------------------
MYSQL_CLIENT_IGNORE_SPACE
Allow space after function names
-----------------------------------
MYSQL_CLIENT_INTERACTIVE
Allow interactive timeout seconds of inactivity before closing the connection
-----------------------------------
MYSQL_CLIENT_SSL
Use SSL encryption (only available with version 4+ of the MySQL client library)
-----------------------------------
MYSQL_ASSOC
Columns are returned into the array with the fieldname as the array index
-----------------------------------
MYSQL_BOTH
Columns are returned into the array having both a numerical index and the fieldname as the array index
-----------------------------------
MYSQL_NUM
Columns are returned into the array having a numerical index (index starts at 0) |
PHP Filesystem Functions
basename()
Returns trailing name component of path
example
-----------------------------------
chgrp()
Changes file group
example
-----------------------------------
chmod()
Changes file mode
example
-----------------------------------
chown()
Changes file owner
example
-----------------------------------
clearstatcache()
Clears file status cache
example
-----------------------------------
copy()
Copies file
example
-----------------------------------
delete()
See unlink or unset
example
-----------------------------------
dirname()
Returns parent directory's path
example
-----------------------------------
disk_free_space()
Returns available space on filesystem or disk partition
example
-----------------------------------
disk_total_space()
Returns the total size of a filesystem or disk partition
example
-----------------------------------
diskfreespace()
Alias of disk_free_space
example
-----------------------------------
fclose()
Closes an open file pointer
example
-----------------------------------
feof()
Tests for end-of-file on a file pointer
example
-----------------------------------
fflush()
Flushes the output to a file
example
-----------------------------------
fgetc()
Gets character from file pointer
example
-----------------------------------
fgetcsv()
Gets line from file pointer and parse for CSV fields
example
-----------------------------------
fgets()
Gets line from file pointer
example
-----------------------------------
fgetss()
Gets line from file pointer and strip HTML tags
example
-----------------------------------
file_exists()
Checks whether a file or directory exists
example
-----------------------------------
file_get_contents()
Reads entire file into a string
example
-----------------------------------
file_put_contents()
Write a string to a file
example
-----------------------------------
file()
Reads entire file into an array
example
-----------------------------------
fileatime()
Gets last access time of file
example
-----------------------------------
filectime()
Gets inode change time of file
example
-----------------------------------
filegroup()
Gets file group
example
-----------------------------------
fileinode()
Gets file inode
example
-----------------------------------
filemtime()
Gets file modification time
example
-----------------------------------
fileowner()
Gets file owner
example
-----------------------------------
fileperms()
Gets file permissions
example
-----------------------------------
filesize()
Gets file size
example
-----------------------------------
filetype()
Gets file type
example
-----------------------------------
flock()
Portable advisory file locking
example
-----------------------------------
fnmatch()
Match filename against a pattern
example
-----------------------------------
fopen()
Opens file or URL
example
-----------------------------------
fpassthru()
Output all remaining data on a file pointer
example
-----------------------------------
fputcsv()
Format line as CSV and write to file pointer
example
-----------------------------------
fputs()
Alias of fwrite
example
-----------------------------------
fread()
Binary-safe file read
example
-----------------------------------
fscanf()
Parses input from a file according to a format
example
-----------------------------------
fseek()
Seeks on a file pointer
example
-----------------------------------
fstat()
Gets information about a file using an open file pointer
example
-----------------------------------
ftell()
Returns the current position of the file read/write pointer
example
-----------------------------------
ftruncate()
Truncates a file to a given length
example
-----------------------------------
fwrite()
Binary-safe file write
example
-----------------------------------
glob()
Find pathnames matching a pattern
example
-----------------------------------
is_dir()
Tells whether the filename is a directory
example
-----------------------------------
is_executable()
Tells whether the filename is executable
example
-----------------------------------
is_file()
Tells whether the filename is a regular file
example
-----------------------------------
is_link()
Tells whether the filename is a symbolic link
example
-----------------------------------
is_readable()
Tells whether a file exists and is readable
example
-----------------------------------
is_uploaded_file()
Tells whether the file was uploaded via HTTP POST
example
-----------------------------------
is_writable()
Tells whether the filename is writable
example
-----------------------------------
is_writeable()
Alias of is_writable
example
-----------------------------------
lchgrp()
Changes group ownership of symlink
example
-----------------------------------
lchown()
Changes user ownership of symlink
example
-----------------------------------
link()
Create a hard link
example
-----------------------------------
linkinfo()
Gets information about a link
example
-----------------------------------
lstat()
Gives information about a file or symbolic link
example
-----------------------------------
mkdir()
Makes directory
example
-----------------------------------
move_uploaded_file()
Moves an uploaded file to a new location
example
-----------------------------------
parse_ini_file()
Parse a configuration file
example
-----------------------------------
parse_ini_string()
Parse a configuration string
example
-----------------------------------
pathinfo()
Returns information about a file path
example
-----------------------------------
pclose()
Closes process file pointer
example
-----------------------------------
popen()
Opens process file pointer
example
-----------------------------------
readfile()
Outputs a file
example
-----------------------------------
readlink()
Returns the target of a symbolic link
example
-----------------------------------
realpath_cache_get()
Get realpath cache entries
example
-----------------------------------
realpath_cache_size()
Get realpath cache size
example
-----------------------------------
realpath()
Returns canonicalized absolute pathname
example
-----------------------------------
rename()
Renames a file or directory
example
-----------------------------------
rewind()
Rewind the position of a file pointer
example
-----------------------------------
rmdir()
Removes directory
example
-----------------------------------
set_file_buffer()
Alias of stream_set_write_buffer
example
-----------------------------------
stat()
Gives information about a file
example
-----------------------------------
symlink()
Creates a symbolic link
example
-----------------------------------
tempnam()
Create file with unique file name
example
-----------------------------------
tmpfile()
Creates a temporary file
example
-----------------------------------
touch()
Sets access and modification time of file
example
-----------------------------------
umask()
Changes the current umask
example
-----------------------------------
unlink()
Deletes a file
example
-----------------------------------
-----------------------------------
FILESYSTEM CONSTANTS
-----------------------------------
SEEK_SET (integer)
SEEK_CUR (integer)
SEEK_END (integer)
LOCK_SH (integer)
LOCK_EX (integer)
LOCK_UN (integer)
LOCK_NB (integer)
GLOB_BRACE (integer)
GLOB_ONLYDIR (integer)
GLOB_MARK (integer)
GLOB_NOSORT (integer)
GLOB_NOCHECK (integer)
GLOB_NOESCAPE (integer)
GLOB_AVAILABLE_FLAGS (integer)
PATHINFO_DIRNAME (integer)
PATHINFO_BASENAME (integer)
PATHINFO_EXTENSION (integer)
PATHINFO_FILENAME (integer)
Since PHP 5.2.0.
-----------------------------------
FILE_USE_INCLUDE_PATH (integer)
Search for filename in include_path (since PHP 5).
-----------------------------------
FILE_NO_DEFAULT_CONTEXT (integer)
FILE_APPEND (integer)
Append content to existing file.
-----------------------------------
FILE_IGNORE_NEW_LINES (integer)
Strip EOL characters (since PHP 5).
-----------------------------------
FILE_SKIP_EMPTY_LINES (integer)
Skip empty lines (since PHP 5).
-----------------------------------
FILE_BINARY (integer)
Binary mode (since PHP 5.2.7).
Note:
This constant has no effect, and is only available for forward compatibility.
-----------------------------------
FILE_TEXT (integer)
Text mode (since PHP 5.2.7).
Note:
This constant has no effect, and is only available for forward compatibility.
-----------------------------------
INI_SCANNER_NORMAL (integer)
Normal INI scanner mode (since PHP 5.3).
-----------------------------------
INI_SCANNER_RAW (integer)
Raw INI scanner mode (since PHP 5.3).
-----------------------------------
FNM_NOESCAPE (integer)
Disable backslash escaping.
-----------------------------------
FNM_PATHNAME (integer)
Slash in string only matches slash in the given pattern.
-----------------------------------
FNM_PERIOD (integer)
Leading period in string must be exactly matched by period in the given pattern.
-----------------------------------
FNM_CASEFOLD (integer)
Caseless match. Part of the GNU extension. |
PHP Directory Functions
chdir()
Change directory
example
-----------------------------------
chroot()
Change the root directory
example
-----------------------------------
closedir()
Close directory handle
example
-----------------------------------
dir()
Return an instance of the Directory class
example
-----------------------------------
getcwd()
Gets the current working directory
example
-----------------------------------
opendir()
Open directory handle
example
-----------------------------------
readdir()
Read entry from directory handle
example
-----------------------------------
rewinddir()
Rewind directory handle
example
-----------------------------------
scandir()
*List files and directories inside the specified path
example
-----------------------------------
-----------------------------------
DIRECTORY CONSTANTS
-----------------------------------
DIRECTORY_SEPARATOR (string)
-----------------------------------
PATH_SEPARATOR (string)
Available since PHP 4.3.0. Semicolon on Windows, colon otherwise.
-----------------------------------
SCANDIR_SORT_ASCENDING (integer)
Available since PHP 5.4.0.
-----------------------------------
SCANDIR_SORT_DESCENDING (integer)
Available since PHP 5.4.0.*
-----------------------------------
SCANDIR_SORT_NONE (integer)
Available since PHP 5.4.0. |
PHP FTP Functions
ftp_alloc()
Allocates space for a file to be uploaded
example
-----------------------------------
ftp_cdup()
Changes to the parent directory
example
-----------------------------------
ftp_chdir()
Changes the current directory on a FTP server
example
-----------------------------------
ftp_chmod()
Set permissions on a file via FTP
example
-----------------------------------
ftp_close()
Closes an FTP connection
example
-----------------------------------
ftp_connect()
Opens an FTP connection
example
-----------------------------------
ftp_delete()
Deletes a file on the FTP server
example
-----------------------------------
ftp_exec()
Requests execution of a command on the FTP server
example
-----------------------------------
ftp_fget()
Downloads a file from the FTP server and saves to an open file
example
-----------------------------------
ftp_fput()
Uploads from an open file to the FTP server
example
-----------------------------------
ftp_get_option()
Retrieves various runtime behaviours of the current FTP stream
example
-----------------------------------
ftp_get()
Downloads a file from the FTP server
example
-----------------------------------
ftp_login()
Logs in to an FTP connection
example
-----------------------------------
ftp_mdtm()
Returns the last modified time of the given file
example
-----------------------------------
ftp_mkdir()
Creates a directory
example
-----------------------------------
ftp_nb_continue()
Continues retrieving/sending a file (non-blocking)
example
-----------------------------------
ftp_nb_fget()
Retrieves a file from the FTP server and writes it to an open file (non-blocking)
example
-----------------------------------
ftp_nb_fput()
Stores a file from an open file to the FTP server (non-blocking)
example
-----------------------------------
ftp_nb_get()
Retrieves a file from the FTP server and writes it to a local file (non-blocking)
example
-----------------------------------
ftp_nb_put()
Stores a file on the FTP server (non-blocking)
example
-----------------------------------
ftp_nlist()
Returns a list of files in the given directory
example
-----------------------------------
ftp_pasv()
Turns passive mode on or off
example
-----------------------------------
ftp_put()
Uploads a file to the FTP server
example
-----------------------------------
ftp_pwd()
Returns the current directory name
example
-----------------------------------
ftp_quit()
Alias of ftp_close
example
-----------------------------------
ftp_raw()
Sends an arbitrary command to an FTP server
example
-----------------------------------
ftp_rawlist()
Returns a detailed list of files in the given directory
example
-----------------------------------
ftp_rename()
Renames a file or a directory on the FTP server
example
-----------------------------------
ftp_rmdir()
Removes a directory
example
-----------------------------------
ftp_set_option()
Set miscellaneous runtime FTP options
example
-----------------------------------
ftp_site()
Sends a SITE command to the server
example
-----------------------------------
ftp_size()
Returns the size of the given file
example
-----------------------------------
ftp_ssl_connect()
Opens an Secure SSL-FTP connection
example
-----------------------------------
ftp_systype()
Returns the system type identifier of the remote FTP server
example
-----------------------------------
-----------------------------------
FTP CONSTANTS
-----------------------------------
FTP_ASCII (integer)
FTP_TEXT (integer)
FTP_BINARY (integer)
FTP_IMAGE (integer)
-----------------------------------
FTP_TIMEOUT_SEC (integer)
See ftp_set_option() for information.
The following constants were introduced in PHP 4.3.0.
-----------------------------------
FTP_AUTOSEEK (integer)
See ftp_set_option() for information.
-----------------------------------
FTP_AUTORESUME (integer)
Automatically determine resume position and start position for GET and PUT requests (only works if FTP_AUTOSEEK is enabled)
-----------------------------------
FTP_FAILED (integer)
Asynchronous transfer has failed
-----------------------------------
FTP_FINISHED (integer)
Asynchronous transfer has finished
-----------------------------------
FTP_MOREDATA (integer)
Asynchronous transfer is still active |
PHP ZIP Functions
zip_close()
Close a ZIP file archive
example
-----------------------------------
zip_entry_close()
Close a directory entry
example
-----------------------------------
zip_entry_compressedsize()
Retrieve the compressed size of a directory entry
example
-----------------------------------
zip_entry_compressionmethod()
Retrieve the compression method of a directory entry
example
-----------------------------------
zip_entry_filesize()
Retrieve the actual file size of a directory entry
example
-----------------------------------
zip_entry_name()
Retrieve the name of a directory entry
example
-----------------------------------
zip_entry_open()
Open a directory entry for reading
example
-----------------------------------
zip_entry_read()
Read from an open directory entry
example
-----------------------------------
zip_open()
Open a ZIP file archive
example
-----------------------------------
zip_read()
Read next entry in a ZIP file archive
example
-----------------------------------
-----------------------------------
ZIP CONSTANTS
-----------------------------------
ZIPARCHIVE::CREATE (integer)
Create the archive if it does not exist.
-----------------------------------
ZIPARCHIVE::OVERWRITE (integer)
Always start a new archive, this mode will overwrite the file if it already exists.
-----------------------------------
ZIPARCHIVE::EXCL (integer)
Error if archive already exists.
-----------------------------------
ZIPARCHIVE::CHECKCONS (integer)
Perform additional consistency checks on the archive, and error if they fail.
-----------------------------------
ZIPARCHIVE::FL_NOCASE (integer)
Ignore case on name lookup
-----------------------------------
ZIPARCHIVE::FL_NODIR (integer)
Ignore directory component
-----------------------------------
ZIPARCHIVE::FL_COMPRESSED (integer)
Read compressed data
-----------------------------------
ZIPARCHIVE::FL_UNCHANGED (integer)
Use original data, ignoring changes.
-----------------------------------
ZIPARCHIVE::CM_DEFAULT (integer)
better of deflate or store.
-----------------------------------
ZIPARCHIVE::CM_STORE (integer)
stored (uncompressed).
-----------------------------------
ZIPARCHIVE::CM_SHRINK (integer)
shrunk
-----------------------------------
ZIPARCHIVE::CM_REDUCE_1 (integer)
reduced with factor 1
-----------------------------------
ZIPARCHIVE::CM_REDUCE_2 (integer)
reduced with factor 2
-----------------------------------
ZIPARCHIVE::CM_REDUCE_3 (integer)
reduced with factor 3
-----------------------------------
ZIPARCHIVE::CM_REDUCE_4 (integer)
reduced with factor 4
-----------------------------------
ZIPARCHIVE::CM_IMPLODE (integer)
imploded
-----------------------------------
ZIPARCHIVE::CM_DEFLATE (integer)
deflated
-----------------------------------
ZIPARCHIVE::CM_DEFLATE64 (integer)
deflate64
-----------------------------------
ZIPARCHIVE::CM_PKWARE_IMPLODE (integer)
PKWARE imploding
-----------------------------------
ZIPARCHIVE::CM_BZIP2 (integer)
BZIP2 algorithm
-----------------------------------
ZIPARCHIVE::ER_OK (integer)
No error.
-----------------------------------
ZIPARCHIVE::ER_MULTIDISK (integer)
Multi-disk zip archives not supported.
-----------------------------------
ZIPARCHIVE::ER_RENAME (integer)
Renaming temporary file failed.
-----------------------------------
ZIPARCHIVE::ER_CLOSE (integer)
Closing zip archive failed
-----------------------------------
ZIPARCHIVE::ER_SEEK (integer)
Seek error
-----------------------------------
ZIPARCHIVE::ER_READ (integer)
Read error
-----------------------------------
ZIPARCHIVE::ER_WRITE (integer)
Write error
-----------------------------------
ZIPARCHIVE::ER_CRC (integer)
CRC error
-----------------------------------
ZIPARCHIVE::ER_ZIPCLOSED (integer)
Containing zip archive was closed
-----------------------------------
ZIPARCHIVE::ER_NOENT (integer)
No such file.
-----------------------------------
ZIPARCHIVE::ER_EXISTS (integer)
File already exists
-----------------------------------
ZIPARCHIVE::ER_OPEN (integer)
Can't open file
-----------------------------------
ZIPARCHIVE::ER_TMPOPEN (integer)
Failure to create temporary file.
-----------------------------------
ZIPARCHIVE::ER_ZLIB (integer)
Zlib error
-----------------------------------
ZIPARCHIVE::ER_MEMORY (integer)
Memory allocation failure
-----------------------------------
ZIPARCHIVE::ER_CHANGED (string)
Entry has been changed*
-----------------------------------
ZIPARCHIVE::ER_COMPNOTSUPP (integer)
Compression method not supported.
-----------------------------------
ZIPARCHIVE::ER_EOF (integer)
Premature EOF
-----------------------------------
ZIPARCHIVE::ER_INVAL (integer)
Invalid argument
-----------------------------------
ZIPARCHIVE::ER_NOZIP (integer)
Not a zip archive
-----------------------------------
ZIPARCHIVE::ER_INTERNAL (integer)
Internal error
-----------------------------------
ZIPARCHIVE::ER_INCONS (integer)
Zip archive inconsistent
-----------------------------------
ZIPARCHIVE::ER_REMOVE (integer)
Can't remove file
-----------------------------------
ZIPARCHIVE::ER_DELETED (integer)
Entry has been deleted |
PHP Filter Functions
filter_has_var()
Checks if variable of specified type exists
example
-----------------------------------
filter_id()
Returns the filter ID belonging to a named filter
example
-----------------------------------
filter_input_array()
Gets external variables and optionally filters them
example
-----------------------------------
filter_input()
Gets a specific external variable by name and optionally filters it
example
-----------------------------------
filter_list()
Returns a list of all supported filters
example
-----------------------------------
filter_var_array()
Gets multiple variables and optionally filters them
example
-----------------------------------
filter_var()
Filters a variable with a specified filter
example
-----------------------------------
-----------------------------------
FILTER CONSTANTS
-----------------------------------
INPUT_POST (integer)
POST variables.
-----------------------------------
INPUT_GET (integer)
GET variables.
-----------------------------------
INPUT_COOKIE (integer)
COOKIE variables.
-----------------------------------
INPUT_ENV (integer)
ENV variables.
-----------------------------------
INPUT_SERVER (integer)
SERVER variables.
-----------------------------------
INPUT_SESSION (integer)
SESSION variables. (not implemented yet)
-----------------------------------
INPUT_REQUEST (integer)
REQUEST variables. (not implemented yet)
-----------------------------------
FILTER_FLAG_NONE (integer)
No flags.
-----------------------------------
FILTER_REQUIRE_SCALAR (integer)
Flag used to require scalar as input
-----------------------------------
FILTER_REQUIRE_ARRAY (integer)
Require an array as input.
-----------------------------------
FILTER_FORCE_ARRAY (integer)
Always returns an array.
-----------------------------------
FILTER_NULL_ON_FAILURE (integer)
Use NULL instead of FALSE on failure.
-----------------------------------
FILTER_VALIDATE_INT (integer)
ID of "int" filter.
-----------------------------------
FILTER_VALIDATE_BOOLEAN (integer)
ID of "boolean" filter.
-----------------------------------
FILTER_VALIDATE_FLOAT (integer)
ID of "float" filter.
-----------------------------------
FILTER_VALIDATE_REGEXP (integer)
ID of "validate_regexp" filter.
-----------------------------------
FILTER_VALIDATE_URL (integer)
ID of "validate_url" filter.
-----------------------------------
FILTER_VALIDATE_EMAIL (integer)
ID of "validate_email" filter.
-----------------------------------
FILTER_VALIDATE_IP (integer)
ID of "validate_ip" filter.
-----------------------------------
FILTER_DEFAULT (integer)
ID of default ("string") filter.
-----------------------------------
FILTER_UNSAFE_RAW (integer)
ID of "unsafe_raw" filter.
-----------------------------------
FILTER_SANITIZE_STRING (integer)
ID of "string" filter.
-----------------------------------
FILTER_SANITIZE_STRIPPED (integer)
ID of "stripped" filter.
-----------------------------------
FILTER_SANITIZE_ENCODED (integer)
ID of "encoded" filter.
-----------------------------------
FILTER_SANITIZE_SPECIAL_CHARS (integer)
ID of "special_chars" filter.
-----------------------------------
FILTER_SANITIZE_EMAIL (integer)
ID of "email" filter.
-----------------------------------
FILTER_SANITIZE_URL (integer)
ID of "url" filter.
-----------------------------------
FILTER_SANITIZE_NUMBER_INT (integer)
ID of "number_int" filter.
-----------------------------------
FILTER_SANITIZE_NUMBER_FLOAT (integer)
ID of "number_float" filter.
-----------------------------------
FILTER_SANITIZE_MAGIC_QUOTES (integer)
ID of "magic_quotes" filter.
-----------------------------------
FILTER_CALLBACK (integer)
ID of "callback" filter.
-----------------------------------
FILTER_FLAG_ALLOW_OCTAL (integer)
Allow octal notation (0[0-7]+) in "int" filter.
-----------------------------------
FILTER_FLAG_ALLOW_HEX (integer)
Allow hex notation (0x[0-9a-fA-F]+) in "int" filter.
-----------------------------------
FILTER_FLAG_STRIP_LOW (integer)
Strip characters with ASCII value less than 32.
-----------------------------------
FILTER_FLAG_STRIP_HIGH (integer)
Strip characters with ASCII value greater than 127.
-----------------------------------
FILTER_FLAG_ENCODE_LOW (integer)
Encode characters with ASCII value less than 32.
-----------------------------------
FILTER_FLAG_ENCODE_HIGH (integer)
Encode characters with ASCII value greater than 127.
-----------------------------------
FILTER_FLAG_ENCODE_AMP (integer)
Encode &.
-----------------------------------
FILTER_FLAG_NO_ENCODE_QUOTES (integer)
Don't encode ' and ".
-----------------------------------
FILTER_FLAG_EMPTY_STRING_NULL (integer)
(No use for now.)
-----------------------------------
FILTER_FLAG_ALLOW_FRACTION (integer)
Allow fractional part in "number_float" filter.
-----------------------------------
FILTER_FLAG_ALLOW_THOUSAND (integer)
Allow thousand separator (,) in "number_float" filter.
-----------------------------------
FILTER_FLAG_ALLOW_SCIENTIFIC (integer)
Allow scientific notation (e, E) in "number_float" filter.
-----------------------------------
FILTER_FLAG_PATH_REQUIRED (integer)
Require path in "validate_url" filter.
-----------------------------------
FILTER_FLAG_QUERY_REQUIRED (integer)
Require query in "validate_url" filter.
-----------------------------------
FILTER_FLAG_IPV4 (integer)
Allow only IPv4 address in "validate_ip" filter.
-----------------------------------
FILTER_FLAG_IPV6 (integer)
Allow only IPv6 address in "validate_ip" filter.
-----------------------------------
FILTER_FLAG_NO_RES_RANGE (integer)
Deny reserved addresses in "validate_ip" filter.
-----------------------------------
FILTER_FLAG_NO_PRIV_RANGE (integer)
Deny private addresses in "validate_ip" filter. |
PHP Misc Functions
connection_aborted
Check whether client disconnected
example
-----------------------------------
connection_status
Returns connection status bitfield
example
-----------------------------------
connection_timeout
Check if the script timed out
example
-----------------------------------
constant
Returns the value of a constant
example
-----------------------------------
define
Defines a named constant
example
-----------------------------------
defined
Checks whether a given named constant exists
example
-----------------------------------
die
Equivalent to exit
example
-----------------------------------
eval
Evaluate a string as PHP code
example
-----------------------------------
exit
Output a message and terminate the current script
example
-----------------------------------
get_browser
Tells what the user's browser is capable of
example
-----------------------------------
__halt_compiler
Halts the compiler execution
example
-----------------------------------
highlight_file
Syntax highlighting of a file
example
-----------------------------------
highlight_string
Syntax highlighting of a string
example
-----------------------------------
ignore_user_abort
Set whether a client disconnect should abort script execution
example
-----------------------------------
pack
Pack data into binary string
example
-----------------------------------
php_check_syntax
Check the PHP syntax of (and execute) the specified file
example
-----------------------------------
php_strip_whitespace
Return source with stripped comments and whitespace
example
-----------------------------------
show_source
Alias of highlight_file
example
-----------------------------------
sleep
Delay execution
example
-----------------------------------
sys_getloadavg
Gets system load average
example
-----------------------------------
time_nanosleep
Delay for a number of seconds and nanoseconds
example
-----------------------------------
time_sleep_until
Make the script sleep until the specified time
example
-----------------------------------
uniqid
Generate a unique ID
example
-----------------------------------
unpack
Unpack data from binary string
example
-----------------------------------
usleep
Delay execution in microseconds
example
-----------------------------------
-----------------------------------
MISC. CONSTANTS
-----------------------------------
CONNECTION_ABORTED (integer)
CONNECTION_NORMAL (integer)
CONNECTION_TIMEOUT (integer)
__COMPILER_HALT_OFFSET__ (integer)
Added in PHP 5.1. |
|
Favourited by 7 Members:
Comments
No comments yet. Add yours below!
Add a Comment
You are posting a reply. Cancel Reply.
Contents
Cheatographer
Cheat Sheet Stats
Tags
Related (shares tags with):
Thumbnail