round Syntax double rounddouble val Description The round function returns the resulting number after rounding val.. sin Syntax float sinfloat arg Description The sin function re
Trang 1Description
The rand() function returns a psuedo-random number The number returned will range between 0 and RAND_MAX or min and max , if they are specified The random
number should be seeded before using this function
round()
Syntax
double round(double val)
Description
The round() function returns the resulting number after rounding val The val
parameter is rounded up when it has a last digit of 5 or greater, and down when the last digit is less than 5
sin()
Syntax
float sin(float arg)
Description
The sin() function returns the sine of arg in radians
sqrt()
Syntax
float sqrt(float arg)
Description
The sqrt() function returns the square root of arg
echo sqrt(16);//displays 4
Trang 2srand()
Syntax
void srand(int seed)
Description
The srand() function seeds the random number generator with seed This allows
rand() to produce varying results
tan()
Syntax
float tan(float arg)
Description
The tan() function returns the tangent of arg in radians
Miscellaneous
The functions in this section provide a variety of useful tools that don't lend themselves to a specific group of operations Some of these tools include information regarding the current status of a connection with a browser along with information about that browser Additionally, some debugging and language constructs dealing with script execution are included
connection_aborted()
Syntax
int connection_aborted(void )
Description
The connection_aborted() function, which was added in PHP 3.0.7 and PHP 4.0b4, returns true if the client has disconnected This is usually due to the user clicking the Stop button on his browser
Trang 3connection_status()
Syntax
int connection_status(void )
Description
The connection_status() function, which was added in PHP 3.0.7 and PHP 4.0b4, returns the connection status bit field The result could indicate a NORMAL status, an ABORTED status, a TIMEOUT status, or a combination of both an ABORTED and TIMEOUT status, in the case that PHP is set to ignore user aborts and continue processing the script after the user aborts
connection_timeout()
Syntax
int connection_timeout(void )
Description
The connection_timeout() function, which was added in PHP 3.0.7 and PHP 4.0b4, returns true if the script has timed out
define()
Syntax
int define(string name, mixed value, int [case_insensitive] )
Description
The define() function declares a named constant Named constants are similar to variables with the following exceptions:
Constants are not referenced with a $ before the name
Constants do not have scope and therefore may be accessed equally
from any part of your code
Trang 4Redefinition of constants is not allowed
Constants may represent only scalar values
The third parameter, case_insensitive , is optional If the value 1 is given, the constant will be defined as case insensitive The default behavior is case sensitive
defined()
Syntax
int defined(string name)
Description
The defined() function returns true if name represents an existing named constant
and returns false otherwise
die()
Syntax
void die(string message)
Description
The die() language construct outputs a message and stops parsing the script There
is no return
//if login unsuccessful
die ("Unauthorized Access – Terminating");
eval()
Syntax
void eval(string code_str)
Description
Trang 5The eval() function executes code_str as PHP code The code_str must adhere to
the normal PHP requirements, including the statement terminator Any variables created in code_str will persist in the main code after function has executed
exit()
Syntax
void exit(void)
Description
The exit() language construct stops the current script from executing and does not return control to the script
func_get_arg()
Syntax
int func_get_arg(int arg_num)
Description
The func_get_arg() function, which was added in PHP 4.0b4, returns the argument located at the arg_num offset into a user-defined function's argument list Arguments
are numbered with a zero base If not called from inside a user function, a warning will be generated
If arg_num is greater than the number of arguments the user-defined function has, a
warning will be generated and a return value of false will be given
func_get_args()
Syntax
int func_gets_args(void )
Description
The func_get_args() function, which was added in PHP 4.0b4, returns an array containing the arguments of the current user-defined function The array counter is zero-based This is similar to the argv[] parameter that is specified in the main