<<

. 102
( 132 .)



>>

string Strips backslashes from a
stripcslashes(string str)
string (uses C-style
conventions)
string Strips backslashes from a
stripslashes(string str)
string
mixed Replaces all occurrences of
str_replace(mixed search,
search in haystack
mixed replace, mixed subject
with replace
[, bool boyer])

string Converts logical Hebrew
hebrev(string str
text to visual text
[, int max_chars_per_line])

string Converts logical Hebrew
hebrevc(string str
text to visual text with
[, int max_chars_per_line])
newline conversion
Continued
614 Part V: Appendixes


TABLE F-2 STRING-MANIPULATION FUNCTIONS (Continued)

Function Return Value Action

string Converts newlines to HTML
nl2br(string str)
line breaks
string Strips HTML and PHP tags
strip_tags(string str
from a string
[, string allowable_tags])

string Sets locale information
setlocale(mixed category,
string locale)

void Parses GET/POST/COOKIE
parse_str(string encoded_string
data and sets global variables
[, array result])

string Returns the input string
str_repeat(string input,
repeated mult times
int mult)

mixed Returns information about
count_chars(string input
what characters are used
[, int mode])
in input
int Returns the result of a
strnatcmp(string s1, string s2)
string comparison using
a “natural” algorithm
array Returns numeric
localeconv(void)
formatting information
based on the current locale
int Returns the result of a
strnatcasecmp(string s1,
case-insensitive string
string s2)
comparison using a
“natural” algorithm
int Returns the number of
substr_count(string haystack,
times a substring occurs
string needle)
in the string
string Returns the input string,
str_pad(string input, int
padded on the left or right
pad_length [, string pad_string
to a specified length with
[, int pad_type]])
pad_string

mixed Implements an ANSI
sscanf(string str, string format
C“compatible sscanf
[, string ...])

string Performs the rot13
str_rot13(string str)
transform on a string
Appendix F: PHP Function Reference 615


TABLE F-3 ARRAY FUNCTIONS

Function Return Value Action

bool Sorts an array by key value
krsort(array array_arg
in reverse order
[, int sort_flags])

bool Sorts an array by key
ksort(array array_arg
[, int sort_flags])

int Counts the number of
count(mixed var [, int mode])
elements in a variable
(usually an array)
void Sorts an array using
natsort(array array_arg)
natural sort
void Sorts an array using case-
natcasesort(array array_arg)
insensitive natural sort
bool Sorts an array and
asort(array array_arg
maintains index association
[, int sort_flags])

bool Sorts an array in reverse
arsort(array array_arg
order and maintains index
[, int sort_flags])
association
bool Sorts an array
sort(array array_arg
[, int sort_flags])

bool Sorts an array in reverse
rsort(array array_arg
order
[, int sort_flags])

bool Sorts an array by values
usort(array array_arg,
using a user-defined
string cmp_function)
comparison function
bool Sorts an array with a
uasort(array array_arg,
user-defined comparison
string cmp_function)
function and maintains
index association
bool Sorts an array by keys
uksort(array array_arg,
using a user-defined
string cmp_function)
comparison function
Continued
616 Part V: Appendixes


TABLE F-3 ARRAY FUNCTIONS (Continued)

Function Return Value Action

mixed Advances the array
end(array array_arg)
argument™s internal pointer
to the last element and
returns it
mixed Moves the array
prev(array array_arg)
argument™s internal pointer
to the previous element
and returns it
mixed Moves the array
next(array array_arg)
argument™s internal pointer
to the next element and
returns it
mixed Sets the array argument™s
reset(array array_arg)
internal pointer to the first
element and returns it
mixed Returns the element
current(array array_arg)
currently pointed to by the
internal array pointer
mixed Returns the key of the
key(array array_arg)
element currently pointed
to by the internal array
pointer
mixed Returns the lowest value
min(mixed arg1 [, mixed arg2
in an array or a series of
[, mixed ...]])
arguments
mixed Returns the highest value
max(mixed arg1 [, mixed arg2
in an array or a series of
[, mixed ...]])
arguments
bool Applies a user function to
array_walk(array input, string
every member of an array
funcname [, mixed userdata])

bool Checks if the given value
in_array(mixed needle, array
exists in the array
haystack [, bool strict])
Appendix F: PHP Function Reference 617



Function Return Value Action

mixed Searches the array for a
array_search(mixed needle,
given value and returns the
array haystack [, bool strict])
corresponding key if
successful
int Imports variables into the
extract(array var_array
symbol table from an array
[, int extract_type
[, string prefix]])

array Creates a hash containing
compact(mixed var_names
variables and their values
[, mixed ...])

array Creates an array
array_fill(int start_key,
containing num elements,
int num, mixed val)
starting with index
start_key, each
initialized to val
array Creates an array
range(mixed low, mixed high)
containing the range of
integers or characters from
low to high (inclusive)
bool Randomly shuffles the
shuffle(array array_arg)
contents of an array
int Pushes elements onto the
array_push(array stack,
end of the array
mixed var [, mixed ...])

mixed Pops an element off the
array_pop(array stack)
end of the array
mixed Pops an element off the
array_shift(array stack)
beginning of the array
int Pushes elements onto the
array_unshift(array stack,
beginning of the array
mixed var [, mixed ...])

array Removes the elements
array_splice(array input,
designated by offset and
int offset [, int length
length and replaces them
[, array replacement]])

<<

. 102
( 132 .)



>>