<<

. 106
( 132 .)



>>

equivalent of the binary
number
int Returns the decimal
hexdec(string
equivalent of the
hexadecimal_number)
hexadecimal number
int Returns the decimal
octdec(string octal_number)
equivalent of an octal string
string Returns a string containing
decbin(int decimal_number)
a binary representation of
the number
string Returns a string containing
decoct(int decimal_number)
an octal representation of
the given number
string Returns a string containing a
dechex(int decimal_number)
hexadecimal representation
of the given number
Continued
632 Part V: Appendixes


TABLE F-14 MATH FUNCTIONS (Continued)

Function Return Value Action

string Converts a number in a
base_convert(string number,
string from any base smaller
int frombase, int tobase)
than or equal to 36 to any
base smaller than or equal
to 36
string Formats a number with
_format(float number
grouped thousands
[, int num_decimal_places
[, string dec_seperator,
string thousands_separator]])

float Returns the remainder of
fmod(float x, float y)
dividing x by y as a float




TABLE F-15 RANDOM-NUMBER FUNCTIONS

Function Return Value Action

void Seeds the random-number
srand([int seed])
generator
void Seeds the Mersenne Twister
mt_srand([int seed])
random-number generator
int Returns a random number
rand([int min, int max])

int Returns a random number
mt_rand([int min, int max])
from the Mersenne Twister
int Returns the maximum value
getrandmax(void)
a random number can have
int Returns the maximum value
mt_getrandmax(void)
a random number from the
Mersenne Twister can have
Appendix F: PHP Function Reference 633


TABLE F-16 REGULAR EXPRESSION FUNCTIONS

Function Return Value Action

int Regular expression match
ereg(string pattern, string
string [, array registers])

int Case-insensitive regular
eregi(string pattern, string
expression match
string [, array registers])

string Replaces a regular
ereg_replace(string pattern,
expression
string replacement, string
string)

string Case-insensitive replace
eregi_replace(string pattern,
regular expression
string replacement, string
string)

array Splits the string into an
split(string pattern,
array by regular expression
string string [, int limit])

array Splits the string into an
spliti(string pattern,
array by regular expression
string string [, int limit])
(case-insensitive)
string Makes a regular expression
sql_regcase(string string)
for case-insensitive match




TABLE F-17 PERL-COMPATIBLE REGULAR EXPRESSION FUNCTIONS

Function Return Value Action

int Performs a Perl-style
preg_match(string pattern,
regular-expression match
string subject [, array
subpatterns])

int Performs a Perl-style
preg_match_all(string pattern,
global-regular-expression
string subject, array
match
subpatterns [, int order])

string Performs a Perl-style
preg_replace(mixed regex,
regular-expression
mixed replace, mixed subject
replacement
[, int limit])

Continued
634 Part V: Appendixes


TABLE F-17 PERL-COMPATIBLE REGULAR EXPRESSION FUNCTIONS (Continued)

Function Return Value Action

string Performs a Perl-style
preg_replace_(mixed regex,
regular-expression
mixed callback, mixed subject
replacement using
[, int limit])
replacement callback
array Splits the string into an
preg_split(string pattern,
array using a Perl-style
string subject [, int limit
regular expression as a
[, int flags]])
delimiter
string Quotes regular-expression
preg_quote(string str,
characters plus an optional
string delim_char)
character
array Searches the array and
preg_grep(string regex,
returns entries that match
array input)
regex




TABLE F-18 VARIABLE-TYPING FUNCTIONS

Function Return Value Action

string Returns the type of the
gettype(mixed var)
variable
bool Sets the type of the variable
settype(mixed var, string type)

int Gets the integer value of a
intval(mixed var [, int base])
variable using the optional
base for the conversion
float Gets the float value of a
floatval(mixed var)
variable
string Gets the string value of a
strval(mixed var)
variable
bool Returns true if the variable
is_null(mixed var)
is NULL
Appendix F: PHP Function Reference 635



Function Return Value Action

bool Returns true if the variable
is_resource(mixed var)
is a resource
bool Returns true if the variable
is_bool(mixed var)
is a Boolean
bool Returns true if the variable
is_long(mixed var)
is a long (integer)
bool Returns true if the variable
is_float(mixed var)
is a floating point value
bool Returns true if the variable
is_string(mixed var)
is a string
bool Returns true if the variable
is_array(mixed var)
is an array
bool Returns true if the variable
is_object(mixed var)
is an object
bool Returns true if the value is
is_numeric(mixed value)
a number or a numeric
string
bool Returns true if the value is
is_scalar(mixed value)
a scalar
bool Returns true if var is
is_callable(mixed var [, bool
callable
syntax_only [, string
callable_name]])




TABLE F-19 SESSION FUNCTIONS

Function Return Value Action

void Sets the session-cookie
session_set_cookie_params(int
parameters
lifetime [, string path [, string
domain [, bool secure]]])

array Returns the session-cookie
session_get_cookie_params(void)
parameters
Continued
636 Part V: Appendixes


TABLE F-19 SESSION FUNCTIONS (Continued)

Function Return Value Action

string Returns the current session
session_name([string newname])
name; if newname is given,
the session name is replaced

<<

. 106
( 132 .)



>>