From b530ac7a604bf221121b5832c3e221902a8684b8 Mon Sep 17 00:00:00 2001 From: Mehdi Achour Date: Mon, 19 Feb 2007 00:04:49 +0000 Subject: [PATCH] ref.misc: switch to new docstyle git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@230198 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../misc/functions/connection-aborted.xml | 41 ++-- .../misc/functions/connection-status.xml | 41 +++- .../misc/functions/connection-timeout.xml | 47 ++-- reference/misc/functions/constant.xml | 53 ++++- reference/misc/functions/define.xml | 78 +++++-- reference/misc/functions/defined.xml | 74 ++++-- reference/misc/functions/die.xml | 9 +- reference/misc/functions/eval.xml | 114 ++++++--- reference/misc/functions/exit.xml | 97 +++++--- reference/misc/functions/get-browser.xml | 126 +++++++--- reference/misc/functions/halt-compiler.xml | 32 ++- reference/misc/functions/highlight-file.xml | 140 +++++++---- reference/misc/functions/highlight-string.xml | 107 +++++++-- .../misc/functions/ignore-user-abort.xml | 58 +++-- reference/misc/functions/pack.xml | 219 +++++++++++++----- reference/misc/functions/php-check-syntax.xml | 52 +++-- .../misc/functions/php-strip-whitespace.xml | 40 +++- reference/misc/functions/show-source.xml | 4 +- reference/misc/functions/sleep.xml | 60 ++++- reference/misc/functions/sys-getloadavg.xml | 15 +- reference/misc/functions/time-nanosleep.xml | 58 +++-- reference/misc/functions/time-sleep-until.xml | 34 ++- reference/misc/functions/uniqid.xml | 124 +++++++--- reference/misc/functions/unpack.xml | 65 +++++- reference/misc/functions/usleep.xml | 92 ++++++-- 25 files changed, 1289 insertions(+), 491 deletions(-) diff --git a/reference/misc/functions/connection-aborted.xml b/reference/misc/functions/connection-aborted.xml index 0d6af0e79c..3c63ce194d 100644 --- a/reference/misc/functions/connection-aborted.xml +++ b/reference/misc/functions/connection-aborted.xml @@ -1,28 +1,43 @@ - - + connection_aborted - Returns &true; if client disconnected + Check whether if client disconnected - - Description + + + &reftitle.description; intconnection_aborted - - Returns &true; if client disconnected. See the Connection Handling - description in the Features - chapter for a complete explanation. - - See also connection_status, and - ignore_user_abort. + Checks whether if the client disconnected. + + + &reftitle.returnvalues; + + Returns 1 if client disconnected, 0 otherwise. + + + + + &reftitle.seealso; + + + connection_status + ignore_user_abort + + Connection Handling + for a complete description of connection handling in PHP. + + + + + - + connection_status Returns connection status bitfield - - Description + + + &reftitle.description; intconnection_status - - Returns the connection status bitfield. See the Connection Handling - description in the Features - chapter for a complete explanation. - - See also connection_aborted, and - ignore_user_abort. + Gets the connection status bitfield. + + + &reftitle.returnvalues; + + Returns the connection status bitfield, which can be used against the + CONNECTION_XXX constants to determine the connection + status. + + + + + &reftitle.seealso; + + + connection_aborted + ignore_user_abort + + Connection Handling + for a complete description of connection handling in PHP. + + + + + - + connection_timeout - Return &true; if script timed out + Check if the script timed out - - Description + + + &reftitle.description; - boolconnection_timeout + intconnection_timeout - - Returns &true; if script timed out. - + + Determines whether if the script timed out. + + + + + &reftitle.returnvalues; + + Returns 1 if the script timed out, 0 otherwise. + + + + + &reftitle.notes; Deprecated @@ -25,17 +36,21 @@ TODO: correct connection handling. Any volunteers? --> + - - See the Connection Handling - description in the Features - chapter for a complete explanation. - + + &reftitle.seealso; - See also connection_status. + + connection_status + + Connection Handling + for a complete description of connection handling in PHP. + + + - + constant Returns the value of a constant - - Description + + + &reftitle.description; mixedconstant stringname - constant will return the value of the - constant indicated by name. + Return the value of the constant indicated by + name. constant is useful if you need to retrieve @@ -25,6 +25,34 @@ This function works also with class constants. + + + + &reftitle.parameters; + + + + name + + + The constant name. + + + + + + + + + &reftitle.returnvalues; + + Returns the value of the constant, or &null; if the constant is not + defined. + + + + + &reftitle.examples; <function>constant</function> example @@ -42,12 +70,19 @@ echo constant("MAXSIZE"); // same thing as the previous line + + + + &reftitle.seealso; - See also define, - defined and the section on Constants. + + define + defined + The section on Constants + + - + define Defines a named constant - - Description + + + &reftitle.description; booldefine stringname @@ -15,22 +15,54 @@ boolcase_insensitive - Defines a named constant at runtime. See the - section on constants - for more details. + Defines a named constant at runtime. + + + + &reftitle.parameters; - The name of the constant is given by name; - the value is given by value. + + + name + + + The name of the constant. + + + + + value + + + The value of the constant. + + + + + case_insensitive + + + If set to &true;, the constant will be defined case-insensitive. + The default behaviour is case-sensitive; i.e. + CONSTANT and Constant represent + different values. + + + + + + + + &reftitle.returnvalues; - The optional third parameter - case_insensitive is also available. If the - value &true; is given, then the constant will be - defined case-insensitive. The default behaviour is - case-sensitive; i.e. CONSTANT and Constant represent different - values. + &return.success; + + + + &reftitle.examples; Defining Constants @@ -50,15 +82,19 @@ echo Greeting; // outputs "Hello you." + + + + &reftitle.seealso; - &return.success; - - - See also defined, - constant and the section on Constants. + + defined + constant + The section on Constants + + - + defined Checks whether a given named constant exists - - Description + + + &reftitle.description; booldefined stringname - Returns &true; if the named constant given by - name has been defined, - &false; otherwise. + Checks whether the given constant exists and is defined. + + + If you want to see if a variable exists, use isset + as defined only applies to constants. If you want to see if a + function exists, use function_exists. + + + + + + &reftitle.parameters; + + + + name + + + The constant name. + + + + + + + + + &reftitle.returnvalues; + + Returns &true; if the named constant given by name + has been defined, &false; otherwise. + + + + + &reftitle.examples; Checking Constants @@ -33,23 +67,21 @@ if (defined('CONSTANT')) { - - - If you want to see if a variable exists, use - isset as defined only - applies to constants. - If you want to see if a function exists, use - function_exists. - - + + + + &reftitle.seealso; - See also define, - constant, - get_defined_constants, - function_exists, and the section on - Constants. + + define + constant + get_defined_constants + function_exists + The section on Constants + + - + die Equivalent to exit - - Description + + + &reftitle.description; This language construct is equivalent to exit. + - + eval Evaluate a string as PHP code - - Description + + + &reftitle.description; mixedeval stringcode_str - - eval evaluates the string given in - code_str as PHP code. Among other things, - this can be useful for storing code in a database text field for - later execution. code_str does not have to - contain PHP Opening - tags. - - + + Evaluates the string given in code_str as PHP code. + Among other things, this can be useful for storing code in a database text + field for later execution. + + There are some factors to keep in mind when using - eval. Remember that the string passed must - be valid PHP code, including things like terminating statements - with a semicolon so the parser doesn't die on the line after the - eval, and properly escaping things in - code_str. To mix HTML output and PHP code - you can use a closing PHP tag to leave PHP mode. - - - Also remember that variables given values under - eval will retain these values in the main - script afterwards. - - - A return statement will terminate the evaluation of - the string immediately. As of PHP 4, eval returns - &null; unless return is called in the evaluated - code, in which case the value passed to return is - returned. In case of a parse error in the evaluated code, - eval returns &false;. - In case of a fatal error in the evaluated code, the whole script exits. + eval. Remember that the string passed must be valid + PHP code, including things like terminating statements with a semicolon so + the parser doesn't die on the line after the eval, + and properly escaping things in code_str. To mix + HTML output and PHP code you can use a closing PHP tag to leave PHP mode. + + + Also remember that variables given values under eval + will retain these values in the main script afterwards. + + + + + &reftitle.parameters; + + + + code_str + + + The code string to be avaluated. + code_str does not have to contain PHP Opening tags. + + + A return statement will immediately terminate the + evaluation of the string . + + + + + + + + + &reftitle.returnvalues; + + As of PHP 4, eval returns &null; unless + return is called in the evaluated code, in which case + the value passed to return is returned. In case of a + parse error in the evaluated code, eval returns + &false;. + + In PHP 3, eval does not return a value. - + + + + + &reftitle.examples; - - <function>eval</function> example - simple text merge - + <function>eval</function> example - simple text merge + + + + &reftitle.notes; &tip.ob-capture; + + + In case of a fatal error in the evaluated code, the whole script exits. + + + + + + &reftitle.seealso; - See also call_user_func. + + call_user_func + diff --git a/reference/misc/functions/exit.xml b/reference/misc/functions/exit.xml index 86715f82f2..f7f9f6e26b 100644 --- a/reference/misc/functions/exit.xml +++ b/reference/misc/functions/exit.xml @@ -1,13 +1,13 @@ - - + exit Output a message and terminate the current script - - Description + + + &reftitle.description; voidexit stringstatus @@ -16,27 +16,50 @@ voidexit intstatus - - - This is not a real function, but a language construct. - - - - - PHP >= 4.2.0 does NOT print the status - if it is an integer. - - - - The exit function terminates execution of - the script. It prints status just before exiting. - - - If status is an integer, that value - will also be used as the exit status. Exit statuses should be in the - range 0 to 254, the exit status 255 is reserved by PHP and shall not be - used. The status 0 is used to terminate the program successfully. - + + Terminates execution of the script. + + + + + &reftitle.parameters; + + + + status + + + If status is a string, this function prints the + status, if set as a string just before exiting. + + + If status is an integer, that + value will also be used as the exit status. Exit statuses should be in + the range 0 to 254, the exit status 255 is reserved by PHP and shall + not be used. The status 0 is used to terminate the program + successfully. + + + + PHP >= 4.2.0 does NOT print the status + if it is an integer. + + + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.examples; <function>exit</function> example @@ -74,15 +97,31 @@ exit(0376); //octal + + + + &reftitle.notes; - - This language construct is equivalent to die. - + + This is not a real function, but a language construct. + + + + This language construct is equivalent to die. + + + + + + &reftitle.seealso; - See also: register_shutdown_function. + + register_shutdown_function + + - + get_browser Tells what the user's browser is capable of - - Description + + + &reftitle.description; mixedget_browser stringuser_agent boolreturn_array - get_browser attempts to determine the - capabilities of the user's browser. This is done by looking up - the browser's information in the browscap.ini + Attempts to determine the capabilities of the user's browser, by looking + up the browser's information in the browscap.ini file. + + + + &reftitle.parameters; - By default, the value of HTTP User-Agent header is - used; however, you can alter this (i.e., look up another browser's - info) by passing the optional user_agent parameter to - get_browser. You can bypass user_agent - parameter with &null; value. + + + user_agent + + + The User Agent to be analyzed. By default, the value of HTTP + User-Agent header is used; however, you can alter this (i.e., look up + another browser's info) by passing this parameter. + + + You can bypass this parameter with a &null; value. + + + + + return_array + + + If set to &true;, this function will return an array + instead of an object. + + + + - - The information is returned in an object, which will contain - various data elements representing, for instance, the browser's - major and minor version numbers and ID string; &true;/&false; values - for features such as frames, JavaScript, and cookies; and so - forth. - - - As of PHP 4.3.2, if the optional parameter - return_array is &true;, this function will return an - array instead of an object. - + + + + &reftitle.returnvalues; + + The information is returned in an object or an array which will contain + various data elements representing, for instance, the browser's major and + minor version numbers and ID string; &true;/&false; values for features + such as frames, JavaScript, and cookies; and so forth. + + + The cookies value simply means that the browser + itself is capable of accepting cookies and does not mean the user has + enabled the browser to accept cookies or not. The only way to test if + cookies are accepted is to set one with setcookie, + reload, and check for the value. + + + + + &reftitle.changelog; + + + + + + &Version; + &Description; + + + + + 4.3.2 + + The optional parameter return_array was added. + + + + + + + + + + &reftitle.examples; Listing all information about the users browser @@ -89,23 +144,21 @@ Array - - The cookies value simply means that the browser - itself is capable of accepting cookies and does not mean the user has - enabled the browser to accept cookies or not. The only way to test if - cookies are accepted is to set one with setcookie, - reload, and check for the value. - + + + + &reftitle.notes; - In order for this to work, your browscap - configuration setting in &php.ini; must point to the correct location of the + In order for this to work, your browscap configuration setting in + &php.ini; must point to the correct location of the browscap.ini file on your system. - browscap.ini is not bundled with PHP, but you - may find an up-to-date php_browscap.ini - file here. + browscap.ini is not bundled with PHP, but you may + find an up-to-date php_browscap.ini file here. While browscap.ini contains information on @@ -114,6 +167,7 @@ Array + + __halt_compiler @@ -14,19 +14,22 @@ - This function halts the execution of the compiler. This can be useful to - embed data in PHP scripts, like the installation files. + Halts the execution of the compiler. This can be useful to embed data in + PHP scripts, like the installation files. + + Byte position of the data start can be determined by the __COMPILER_HALT_OFFSET__ constant which is defined only if there is a __halt_compiler presented in the file. - - - __halt_compiler can only be used from the outermost - scope. - - + + + + &reftitle.returnvalues; + + &return.void; + @@ -54,6 +57,17 @@ __halt_compiler();the installation data (eg. tar, gz, PHP, etc.) + + + &reftitle.notes; + + + __halt_compiler can only be used from the outermost + scope. + + + + - + highlight_file Syntax highlighting of a file - - Description + + + &reftitle.description; mixedhighlight_file stringfilename boolreturn - - The highlight_file function prints out a syntax - highlighted version of the code contained in filename - using the colors defined in the built-in syntax highlighter for PHP. - - - If the second parameter return is set to &true; - then highlight_file will return the highlighted - code as a string instead of printing it out. If the second parameter is - not set to &true; then highlight_file will - return &true; on success, &false; on failure. - - ¬e.uses-ob; - - - The return parameter became available in PHP - 4.2.0. Before this time it behaved like the default, which is &false; - - - - - Since PHP 4.2.1 this function is also affected by safe_mode and open_basedir. - - - - - Care should be taken when using the - highlight_file function to make sure that - you do not inadvertently reveal sensitive information such as - passwords or any other type of information that might create a - potential security risk. - - + + Prints out or return a syntax highlighted version of the code contained + in filename using the colors defined in the + built-in syntax highlighter for PHP. + Many servers are configured to automatically highlight files with a phps extension. For example, @@ -60,10 +30,96 @@ AddType application/x-httpd-php-source .phps ]]> - - See also highlight_string. - + + + &reftitle.parameters; + + + + filename + + + Path to the PHP file to be highlighted. + + + + + return + + + Set this parameter to &true; to make this function return the + highlighted code. + + + + + + + + + &reftitle.returnvalues; + + If return is set to &true;, returns the highlighted + code as a string instead of printing it out. Otherwise, it will return + &true; on success, &false; on failure. + + + + + &reftitle.changelog; + + + + + + &Version; + &Description; + + + + + 4.2.1 + + This function is now also affected by safe_mode and open_basedir. + + + + 4.2.0 + + The return parameter was added. + + + + + + + + + + &reftitle.notes; + + + Care should be taken when using the highlight_file + function to make sure that you do not inadvertently reveal sensitive + information such as passwords or any other type of information that might + create a potential security risk. + + + ¬e.uses-ob; + + + + &reftitle.seealso; + + + highlight_string + + + + - + highlight_string Syntax highlighting of a string - - Description + + + &reftitle.description; mixedhighlight_string stringstr boolreturn - The highlight_string function outputs a syntax - highlighted version of str using the colors defined - in the built-in syntax highlighter for PHP. + Outputs or returns a syntax highlighted version of the given PHP code + using the colors defined in the built-in syntax highlighter for PHP. - - If the second parameter return is set to &true; - then highlight_string will return the highlighted - code as a string instead of printing it out. If the second parameter is - not set to &true; then highlight_string will - return &true; on success, &false; on failure. - - ¬e.uses-ob; + + + + &reftitle.parameters; + + + + str + + + The PHP code to be highligthed. This should include the opening tag. + + + + + return + + + Set this parameter to &true; to make this function return the + highlighted code. + + + + + + + + + &reftitle.returnvalues; + + If return is set to &true;, returns the highlighted + code as a string instead of printing it out. Otherwise, it will return + &true; on success, &false; on failure. + + + + + &reftitle.changelog; + + + + + + &Version; + &Description; + + + + + 4.2.0 + + The return parameter was added. + + + + + + + + + + &reftitle.examples; <function>highlight_string</function> example @@ -60,16 +113,22 @@ highlight_string(''); - - - The return parameter became available in PHP - 4.2.0. Before this time it behaved like the default, which is &false; - - - - See also highlight_file. - + + + &reftitle.notes; + ¬e.uses-ob; + + + + &reftitle.seealso; + + + highlight_file + + + + - + ignore_user_abort Set whether a client disconnect should abort script execution - - Description + + + &reftitle.description; intignore_user_abort boolsetting - - This function sets whether a client disconnect should cause a - script to be aborted. It will return the previous setting and - can be called without an argument to not change the current - setting and only return the current setting. See the Connection Handling - section in the Features chapter - for a complete description of connection handling in PHP. - - See also connection_aborted, and - connection_status. + Sets whether a client disconnect should cause a script to be aborted. + + + &reftitle.parameters; + + + + setting + + + If not set, the function will only return the current setting. + + + + + + + + + &reftitle.returnvalues; + + Returns the previous setting, as a boolean. + + + + + &reftitle.seealso; + + + connection_aborted + connection_status + + Connection Handling + for a complete description of connection handling in PHP. + + + + + + @@ -16,58 +16,159 @@ Pack given arguments into binary string according to - format. Returns binary string containing - data. + format. - The idea to this function was taken from Perl and all formatting - codes work the same as there, however, there are some formatting - codes that are missing such as Perl's "u" format code. The format - string consists of format codes followed by an optional repeater - argument. The repeater argument can be either an integer value or - * for repeating to the end of the input data. For a, A, h, H the - repeat count specifies how many characters of one data argument - are taken, for @ it is the absolute position where to put the - next data, for everything else the repeat count specifies how - many data arguments are consumed and packed into the resulting - binary string. Currently implemented are + The idea to this function was taken from Perl and all formatting codes + work the same as there, however, there are some formatting codes that are + missing such as Perl's "u" format code. - - <function>pack</function> format characters - - - - Code - Description - - - - aNUL-padded string - ASPACE-padded string - hHex string, low nibble first - HHex string, high nibble first - csigned char - Cunsigned char - ssigned short (always 16 bit, machine byte order) - Sunsigned short (always 16 bit, machine byte order) - nunsigned short (always 16 bit, big endian byte order) - vunsigned short (always 16 bit, little endian byte order) - isigned integer (machine dependent size and byte order) - Iunsigned integer (machine dependent size and byte order) - lsigned long (always 32 bit, machine byte order) - Lunsigned long (always 32 bit, machine byte order) - Nunsigned long (always 32 bit, big endian byte order) - Vunsigned long (always 32 bit, little endian byte order) - ffloat (machine dependent size and representation) - ddouble (machine dependent size and representation) - xNUL byte - XBack up one byte - @NUL-fill to absolute position - - -
+ Note that the distinction between signed and unsigned values only + affects the function unpack, where as + function pack gives the same result for + signed and unsigned format codes.
+ + Also note that PHP internally stores integer values as + signed values of a machine dependent size. If you give it an unsigned + integer value too large to be stored that way it is converted to a + float which often yields an undesired result. + + + + + &reftitle.parameters; + + + + format + + + The format string consists of format codes + followed by an optional repeater argument. The repeater argument can + be either an integer value or * for repeating to + the end of the input data. For a, A, h, H the repeat count specifies + how many characters of one data argument are taken, for @ it is the + absolute position where to put the next data, for everything else the + repeat count specifies how many data arguments are consumed and packed + into the resulting binary string. + + + Currently implemented formats are: + + <function>pack</function> format characters + + + + Code + Description + + + + + a + NUL-padded string + + + A + SPACE-padded string + + h + Hex string, low nibble first + + H + Hex string, high nibble first + csigned char + + C + unsigned char + + s + signed short (always 16 bit, machine byte order) + + + S + unsigned short (always 16 bit, machine byte order) + + + n + unsigned short (always 16 bit, big endian byte order) + + + v + unsigned short (always 16 bit, little endian byte order) + + + i + signed integer (machine dependent size and byte order) + + + I + unsigned integer (machine dependent size and byte order) + + + l + signed long (always 32 bit, machine byte order) + + + L + unsigned long (always 32 bit, machine byte order) + + + N + unsigned long (always 32 bit, big endian byte order) + + + V + unsigned long (always 32 bit, little endian byte order) + + + f + float (machine dependent size and representation) + + + d + double (machine dependent size and representation) + + + x + NUL byte + + + X + Back up one byte + + + @ + NUL-fill to absolute position + + + +
+
+
+
+ + args + + + + + +
+
+
+ + + &reftitle.returnvalues; + + Returns a binary string containing data. + + + + + &reftitle.examples; <function>pack</function> example @@ -84,23 +185,17 @@ $binarydata = pack("nvc*", 0x1234, 0x5678, 65, 66); + + + + &reftitle.seealso; - Note that the distinction between signed and unsigned values only - affects the function unpack, where as - function pack gives the same result for - signed and unsigned format codes. - - - Also note that PHP internally stores integer values as - signed values of a machine dependent size. If you give it an unsigned - integer value too large to be stored that way it is converted to a - float which often yields an undesired result. - - - See also - unpack. + + unpack + +
+ php_check_syntax @@ -11,34 +11,41 @@ &reftitle.description; boolphp_check_syntax - stringfile_name + stringfilename stringerror_message - - For technical reasons, this function is deprecated and removed from PHP. - Instead, use php -l somefile.php from the - commandline. - - - The php_check_syntax function performs a syntax - (lint) check on the specified filename testing - for scripting errors. This is similar to using php -l - from the commandline except - php_check_syntax will execute (but not output) - the checked file_name. For example, if a function - is defined in file_name, this defined function will - be available to the file that executed + + Performs a syntax (lint) check on the specified + filename testing for scripting errors. + + + This is similar to using php -l from the commandline except that this + function will execute (but not output) the checked + filename. + + + For example, if a function is defined in filename, + this defined function will be available to the file that executed php_check_syntax, but output from - file_name will be suppressed. + filename will be suppressed. + + - + + For technical reasons, this function is deprecated and removed from PHP. + Instead, use php -l somefile.php from the + commandline. + + + &reftitle.parameters; - file_name + filename The name of the file being checked. @@ -59,13 +66,15 @@ + &reftitle.returnvalues; Returns &true; if the lint check passed, and &false; if the link check - failed or if file_name cannot be opened. + failed or if filename cannot be opened. + &reftitle.changelog; @@ -102,6 +111,7 @@ + &reftitle.examples; @@ -120,6 +130,7 @@ PHP Parse error: unexpected T_STRING in /tmp/somefile.php on line 81 + &reftitle.seealso; @@ -129,6 +140,7 @@ PHP Parse error: unexpected T_STRING in /tmp/somefile.php on line 81 + + php_strip_whitespace Return source with stripped comments and whitespace - + + &reftitle.description; stringphp_strip_whitespace @@ -18,6 +19,30 @@ This is similar to using php -w from the commandline. + + + + &reftitle.parameters; + + + + filename + + + Path to the PHP file. + + + + + + + + + &reftitle.returnvalues; + + The stripped source code will be returned on success, or an empty string + on failure. + This function works as described as of PHP 5.0.1. Before this it would @@ -27,14 +52,8 @@ - - &reftitle.returnvalues; - - The stripped source code will be returned on success, or an empty string - on failure. - - - + + &reftitle.examples; @@ -68,6 +87,7 @@ do_nothing(); + - + show_source @@ -14,6 +13,7 @@ highlight_file. + - + sleep Delay execution - - Description + + + &reftitle.description; intsleep intseconds - The sleep function delays program execution for the - given number of seconds. + Delays the program execution for the given number of + seconds. + + + + &reftitle.parameters; + + + + seconds + + + Halt time in seconds. + + + + + + + + + &reftitle.returnvalues; + + Returns zero on success, or &false; on errors. + + + + + &reftitle.errors; + + If the specified number of seconds is negative, + this function will generate a E_WARNING. + + + + + &reftitle.examples; <function>sleep</function> example @@ -46,11 +81,16 @@ echo date('h:i:s') . "\n"; - - See also usleep and - set_time_limit - + + + &reftitle.seealso; + + usleep, + set_time_limit + + + + sys_getloadavg - - get average system load - + Gets system load average &reftitle.description; @@ -14,11 +12,10 @@ - This function returns three samples representing the average system load + Returns three samples representing the average system load (the number of processes in the system run queue) over the last 1, 5 and 15 minutes, respectively. - ¬e.no-windows; @@ -48,6 +45,12 @@ if ($load[0] > 80) { + + + &reftitle.notes; + ¬e.no-windows; + + + time_nanosleep Delay for a number of seconds and nanoseconds - + + &reftitle.description; mixedtime_nanosleep @@ -16,13 +17,33 @@ Delays program execution for the given number of seconds and nanoseconds. + + + + &reftitle.parameters; - seconds must be a positive integer, and - nanoseconds must be a positive integer less than - 1 billion. + + + seconds + + + Must be a positive integer. + + + + + nanoseconds + + + Must be a positive integer less than 1 billion. + + + + - + + &reftitle.returnvalues; &return.success; @@ -46,15 +67,8 @@ - - &reftitle.seealso; - - sleep, - usleep, - set_time_limit - - - + + &reftitle.examples; @@ -90,8 +104,22 @@ if ($nano === true) { + + + + &reftitle.notes; ¬e.no-windows; + + + &reftitle.seealso; + + sleep, + usleep, + set_time_limit + + + + time_sleep_until @@ -7,6 +7,7 @@ Make the script sleep until the specified time + &reftitle.description; @@ -14,13 +15,9 @@ floattimestamp - This function will make the script sleep until the specified - timestamp. If the specified - timestamp is in the past, - time_sleep_until will generate a - E_WARNING and return &false;. + Makes the script sleep until the specified + timestamp. - ¬e.no-windows; @@ -37,11 +34,6 @@ - - - All signals will be delivered after the script wakes up. - - @@ -51,6 +43,14 @@ + + &reftitle.errors; + + If the specified timestamp is in the past, this + function will generate a E_WARNING. + + + &reftitle.examples; @@ -73,6 +73,16 @@ var_dump(time_sleep_until(time()+0.2)); + + &reftitle.notes; + + + All signals will be delivered after the script wakes up. + + + ¬e.no-windows; + + &reftitle.seealso; diff --git a/reference/misc/functions/uniqid.xml b/reference/misc/functions/uniqid.xml index 9fb9d625a0..c34479d52c 100644 --- a/reference/misc/functions/uniqid.xml +++ b/reference/misc/functions/uniqid.xml @@ -1,50 +1,76 @@ - - + uniqid Generate a unique ID - - Description + + + &reftitle.description; stringuniqid stringprefix boolmore_entropy - - uniqid returns a prefixed unique identifier - based on the current time in microseconds. prefix - became optional in PHP 5 but can be useful, for instance, if you generate identifiers - simultaneously on several hosts that might happen to generate the - identifier at the same microsecond. Up until PHP 4.3.1, - prefix could only be a maximum of 114 - characters long. - - - If the optional more_entropy parameter is - &true;, uniqid will add additional entropy (using - the combined linear congruential generator) at the end of the return - value, which should make the results more unique. - - - With an empty prefix, the returned string - will be 13 characters long. If more_entropy is - &true;, it will be 23 characters. - - - - The prefix parameter is required before PHP 5. - - + + Gets a prefixed unique identifier based on the current time in + microseconds. + + + + + &reftitle.parameters; + + + + prefix + + + Can be useful, for instance, if you generate identifiers + simultaneously on several hosts that might happen to generate the + identifier at the same microsecond. + + + With an empty prefix, the returned string will + be 13 characters long. If more_entropy is + &true;, it will be 23 characters. + + + + + more_entropy + + + If set to &true;, uniqid will add additional + entropy (using the combined linear congruential generator) at the end + of the return value, which should make the results more unique. + + + + + + + + + &reftitle.returnvalues; + + Returns the unique identifier, as a string. + + + + + &reftitle.examples; If you need a unique identifier or token and you intend to give out that token to the user via the network (i.e. session cookies), it is recommended that you use something along these lines: - + This will create a 32 character identifier (a 128 bit hex number) + that is extremely difficult to predict. + + <function>uniqid</function> Example ]]> - + - - This will create a 32 character identifier (a 128 bit hex number) - that is extremely difficult to predict. - + + + &reftitle.changelog; + + + + + + &Version; + &Description; + + + + + 5.0.0 + + The prefix parameter was made optional. + + + + 4.3.1 + + The limit of 114 characters long for prefix + was raised. + + + + + + + + - + unpack Unpack data from binary string - - Description + + + &reftitle.description; arrayunpack stringformat stringdata - unpack from binary string into array - according to format. Returns array - containing unpacked elements of binary string. + Unpacks from a binary string into an array according to the given + format. unpack works slightly different from Perl as the unpacked data is stored in an associative array. To accomplish this you have to name the different format codes and separate them by a slash /. + + + + + &reftitle.parameters; + + + + format + + + See pack for an explanation of the format codes. + + + + + data + + + The packed data. + + + + + + + + + &reftitle.returnvalues; + + Returns an associative array containing unpacked elements of binary + string. + + + + + &reftitle.examples; + <function>unpack</function> example @@ -38,6 +75,10 @@ $array = unpack("c2chars/nint", $binarydata); + + + + &reftitle.notes; Note that PHP internally stores integral values as signed. If you @@ -46,11 +87,17 @@ $array = unpack("c2chars/nint", $binarydata); even though unsigned unpacking was specified. + + + + &reftitle.seealso; - See also pack for an explanation of the format - codes. + + pack + + - + usleep Delay execution in microseconds - - Description + + + &reftitle.description; voidusleep intmicro_seconds - - The usleep function delays program execution - for the given number of micro_seconds. A - microsecond is one millionth of a second. - + + Delays program execution for the given number of micro seconds. + + + + + &reftitle.parameters; + + + + micro_seconds + + + Halt time in micro seconds. A micro second is one millionth of a + second. + + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.changelog; + + + + + + &Version; + &Description; + + + + + 5.0.0 + + This function now works on Windows systems. + + + + + + + + + + &reftitle.examples; <function>usleep</function> example @@ -36,9 +86,7 @@ echo date('h:i:s') . "\n"; ?> ]]> - - This script will output : - + &example.outputs; - - - This function did not work on Windows systems until PHP 5.0.0 - - - - See also sleep and - set_time_limit. - + + + &reftitle.seealso; + + + sleep + set_time_limit + + + +